Merge pull request #6500 from davipatury/secure_data-ui

Security Records Nano-UI-ification
This commit is contained in:
Crazy Lemon
2017-02-25 16:59:59 -08:00
committed by GitHub
4 changed files with 673 additions and 532 deletions
File diff suppressed because it is too large Load Diff
+13 -17
View File
@@ -923,12 +923,11 @@
if(R.fields["id"] == E.fields["id"])
if(hasHUD(usr,"security"))
read = 1
var/counter = 1
while(R.fields[text("com_[]", counter)])
to_chat(usr, text("[]", R.fields[text("com_[]", counter)]))
counter++
if(counter == 1)
to_chat(usr, "No comment found")
if(length(R.fields["comments"]))
for(var/c in R.fields["comments"])
to_chat(usr, c)
else
to_chat(usr, "<span class='warning'>No comment found</span>")
to_chat(usr, "<a href='?src=[UID()];secrecordadd=`'>\[Add comment\]</a>")
if(!read)
@@ -950,21 +949,18 @@
for(var/datum/data/record/R in data_core.security)
if(R.fields["id"] == E.fields["id"])
if(hasHUD(usr,"security"))
var/t1 = sanitize(copytext(input("Add Comment:", "Sec. records", null, null) as message,1,MAX_MESSAGE_LEN))
if( !(t1) || usr.stat || usr.restrained() || !(hasHUD(usr,"security")) )
var/t1 = copytext(trim(sanitize(input("Add Comment:", "Sec. records", null, null) as message)), 1, MAX_MESSAGE_LEN)
if(!t1 || usr.stat || usr.restrained() || !hasHUD(usr, "security"))
return
var/counter = 1
while(R.fields[text("com_[]", counter)])
counter++
if(istype(usr,/mob/living/carbon/human))
if(ishuman(usr))
var/mob/living/carbon/human/U = usr
R.fields[text("com_[counter]")] = text("Made by [U.get_authentification_name()] ([U.get_assignment()]) on [time2text(world.realtime, "DDD MMM DD hh:mm:ss")], [game_year]<BR>[t1]")
if(istype(usr,/mob/living/silicon/robot))
R.fields["comments"] += "Made by [U.get_authentification_name()] ([U.get_assignment()]) on [current_date_string] [worldtime2text()]<BR>[t1]"
if(isrobot(usr))
var/mob/living/silicon/robot/U = usr
R.fields[text("com_[counter]")] = text("Made by [U.name] ([U.modtype] [U.braintype]) on [time2text(world.realtime, "DDD MMM DD hh:mm:ss")], [game_year]<BR>[t1]")
if(istype(usr,/mob/living/silicon/ai))
R.fields["comments"] += "Made by [U.name] ([U.modtype] [U.braintype]) on [current_date_string] [worldtime2text()]<BR>[t1]"
if(isAI(usr))
var/mob/living/silicon/ai/U = usr
R.fields[text("com_[counter]")] = text("Made by [U.name] (artificial intelligence) on [time2text(world.realtime, "DDD MMM DD hh:mm:ss")], [game_year]<BR>[t1]")
R.fields["comments"] += "Made by [U.name] (artificial intelligence) on [current_date_string] [worldtime2text()]<BR>[t1]"
if(href_list["medical"])
if(hasHUD(usr,"medical"))
+3 -5
View File
@@ -110,17 +110,15 @@
for(var/datum/data/record/G in data_core.general)
var/datum/data/record/S
for(var/datum/data/record/R in data_core.security)
if((R.fields["name"] == G.fields["name"] || R.fields["id"] == G.fields["id"]))
if(R.fields["name"] == G.fields["name"] || R.fields["id"] == G.fields["id"])
S = R
break
var/obj/item/weapon/paper/P = new /obj/item/weapon/paper(src)
P.info = "<CENTER><B>Security Record</B></CENTER><BR>"
P.info += "Name: [G.fields["name"]] ID: [G.fields["id"]]<BR>\nSex: [G.fields["sex"]]<BR>\nAge: [G.fields["age"]]<BR>\nFingerprint: [G.fields["fingerprint"]]<BR>\nPhysical Status: [G.fields["p_stat"]]<BR>\nMental Status: [G.fields["m_stat"]]<BR>"
P.info += "<BR>\n<CENTER><B>Security Data</B></CENTER><BR>\nCriminal Status: [S.fields["criminal"]]<BR>\n<BR>\nMinor Crimes: [S.fields["mi_crim"]]<BR>\nDetails: [S.fields["mi_crim_d"]]<BR>\n<BR>\nMajor Crimes: [S.fields["ma_crim"]]<BR>\nDetails: [S.fields["ma_crim_d"]]<BR>\n<BR>\nImportant Notes:<BR>\n\t[S.fields["notes"]]<BR>\n<BR>\n<CENTER><B>Comments/Log</B></CENTER><BR>"
var/counter = 1
while(S.fields["com_[counter]"])
P.info += "[S.fields["com_[counter]"]]<BR>"
counter++
for(var/c in S.fields["comments"])
P.info += "[c]<BR>"
P.info += "</TT>"
P.name = "paper - '[G.fields["name"]]'"
virgin = 0 //tabbing here is correct- it's possible for people to try and use it
+230
View File
@@ -0,0 +1,230 @@
<!--
Title: Security Records UI
Used In File(s): \code\game\machinery\computer\security.dm
-->
<!--
#define SEC_DATA_R_LIST 1 // Main menu
#define SEC_DATA_MAINT 2 // Record list
#define SEC_DATA_RECORD 3 // Records maintenance
-->
{{if !data.temp && data.screen == 1}}
<script type='text/javascript'>
var hidden;
function updateSearch(){
var filter_text = document.getElementById('filter');
var filter = filter_text.value.toLowerCase();
if(hidden != null){
hidden.parent("td").parent("tr").show()
}
if(filter == ""){
return;
} else {
hidden = $("#maintable_data").children("tbody").children("tr").children("td").children("input").filter(function(index) {
return $(this)[0].value.toLowerCase().indexOf(filter) == -1
});
hidden.parent("td").parent("tr").hide()
}
}
function selectTextField(){
var filter_text = document.getElementById('filter');
filter_text.focus();
filter_text.select();
}
$(window).load(function() {
selectTextField();
updateSearch();
});
$("#filter").keyup(function() {
updateSearch();
});
</script>
{{/if}}
<style type="text/css">
.infoButton {
background: none;
border: none;
}
input[type=text], input[type=submit] {
border: 1px solid #161616;
background-color: #40628a;
color: #FFFFFF;
padding: 4px;
}
input[type=submit]:hover {
background-color: #507aac;
}
</style>
<div class="item">
<div class="itemLabelNarrow">
<b>Confirm Identity:</b>
</div>
<div class="itemContent">
{{:helper.link(data.scan ? data.scan : "----------", 'eject', {'scan' : 1}, null, data.scan ? 'itemContentWide' : 'fixedLeft')}}
</div>
</div>
<hr>
{{if data.authenticated}}
{{if data.screen == 1}} <!-- SEC_DATA_R_LIST -->
<div style="text-align: center;">
<div style="display: inline-block;">{{:helper.link('New Record', 'plus', {'new_g' : 1})}}</div>
</div>
<h3><center>Record List</center></h3>
<table width='560' align='center' cellspacing='0' cellpadding='5' id='maintable'>
<tr id='search_tr'>
<td align='center'>
<b>Search:</b> <input type='text' id='filter' value='' style='width:300px;'></input>
</td>
</tr>
</table>
<div class="statusDisplay" style="overflow: auto;">
<span id='maintable_data_archive'>
<table style='width: 100%' id='maintable_data'>
<thead>
<tr>
<th>{{:helper.link('Name', null, {'sort' : 'name'}, null, 'infoButton')}}</th>
<th>{{:helper.link('ID', null, {'sort' : 'id'}, null, 'infoButton')}}</th>
<th>{{:helper.link('Rank', null, {'sort' : 'rank'}, null, 'infoButton')}}</th>
<th>{{:helper.link('Fingerprints', null, {'sort' : 'fingerprint'}, null, 'infoButton')}}</th>
<th>{{:helper.link('Criminal Status', null, {'sort' : 'name'}, null, 'infoButton')}}</th>
</tr>
</thead>
<tbody>
{{for data.records}}
<tr style={{:value.background}}>
<td><input type='hidden' value='{{:value.name}} {{:value.id}} {{:value.rank}} {{:value.fingerprint}} {{:value.crimstat}}'></input> {{:helper.link(value.name, 'user', {'d_rec' : value.ref}, null, 'infoButton')}}</td>
<td>{{:value.id}}</td>
<td>{{:value.rank}}</td>
<td>{{:value.fingerprint}}</td>
<td>{{:value.crimstat}}</td>
</tr>
{{/for}}
</tbody>
</table>
</span>
</div>
<h3><center>Menu</center></h3>
<div class="line">{{:helper.link('Record Maintenance', 'wrench', {'screen' : 2})}}</div>
<div class="line">{{:helper.link('Logout', 'lock', {'logout' : 1})}}</div>
{{else data.screen == 2}} <!-- SEC_DATA_MAINT -->
<h3>Records Maintenance</h3>
<div class="line">{{:helper.link('Backup To Disk', 'download', {'back' : 1}, 'disabled')}}</div>
<div class="line">{{:helper.link('Upload From disk', 'upload', {'u_load' : 1}, 'disabled')}}</div>
<div class="line">{{:helper.link('Delete All Records', 'trash', {'del_all' : 1})}}</div>
<div class="line">{{:helper.link('Back', 'arrow-left', {'screen' : 1})}}</div>
{{else data.screen == 3}} <!-- SEC_DATA_RECORD -->
<h3><center>Security Record</center></h3>
<h4><center>General Data</center></h4>
{{if data.general.empty}}
<span class="bad"><center>General Record Lost!</center></span>
{{else}}
<div class="statusDisplayRecords">
<table style='width:100%'><tr>
<td valign='top' style='margin-right: 300px;'>
{{for data.general.fields}}
<div class="item">
<div class="itemLabel">
{{:value.field}}
</div>
<div class="itemContent">
{{:helper.link(value.value, value.edit ? 'pencil' : 'user-times', {'field' : value.edit}, value.edit ? null : 'disabled')}}
</div>
</div>
{{/for}}
</td>
<td valign='middle' align='center' style='width: 300px;'>
{{if data.general.has_photos}}
<div style="text-align: center;">
<div style="display: inline-block;">{{:helper.link('Print photo', 'camera', {'print_p' : 1})}}</div>
</div>
{{for data.general.photos}}
{{if value.photo}}
<img src={{:value.photo}} height=96 width=96 border=5>
{{/if}}
{{/for}}
{{/if}}
</td>
</tr></table>
</div>
{{/if}}
<h4><center>Security Data</center></h4>
{{if data.security.empty}}
<span class="bad"><center>Security Record Lost!</center></span>
<div style="text-align: center;">
<div style="display: inline-block; height: 100%; vertical-align: middle;">{{:helper.link('New Record', 'plus', {'new_s' : 1})}}</div>
</div>
<h3><center>Menu</center></h3>
{{else}}
{{for data.security.fields}}
<div class="item">
<div class="itemLabel">
{{:value.field}}
</div>
<div class="itemContent">
{{:helper.link(value.value, 'pencil', {'field' : value.edit})}}
</div>
</div>
{{if value.line_break}}
<br>
{{/if}}
{{/for}}
<h4><center>Comments/Log</center></h4>
{{for data.security.comments}}
<div class="line">{{:value}}</div>
<div class="line">{{:helper.link('Remove entry', 'trash', {'del_c' : index})}}</div>
<br><hr>
{{/for}}
<div style="text-align: center;">
<div style="display: inline-block; height: 100%; vertical-align: middle;">{{:helper.link('Add Entry', 'plus', {'add_c' : 1})}}</div>
</div>
<h3><center>Menu</center></h3>
<div class="line">{{:helper.link('Delete Record (Security Only)', 'trash', {'del_r' : 1})}}</div>
{{/if}}
<div class="line">{{:helper.link('Delete Record (All)', 'trash', {'del_rg' : 1})}}</div>
<div class="line">{{:helper.link('Print Record', 'print', {'print_r' : 1})}}</div>
<div class="line">{{:helper.link('Back', 'arrow-left', {'screen' : 1})}}</div>
{{/if}}
{{else}}
<h3>Menu</h3>
{{:helper.link('Login', 'unlock', {'login' : 1})}}
{{/if}}
{{if data.temp}}
<div class="mask" style="display: table;">
<div class="maskContent" style="margin: 0px; vertical-align: middle; display: table-cell;">
{{if data.temp.notice}}
<div class="notice"><center>{{:data.temp.text}}</center></div>
{{else}}
<center>{{:data.temp.text}}</center>
{{/if}}
{{if data.temp.has_buttons}}
<div class="line">
<div style="display: inline-block;">
<div style="width: 500px; display: flex; display: -webkit-flex; flex-wrap: wrap; -webkit-flex-wrap: wrap; justify-content: center; -webkit-justify-content: center;">
{{for data.temp.buttons}}
{{:helper.link(value.name, value.icon, {'temp' : 1, 'temp_action' : value.href}, value.status)}}
{{/for}}
</div>
</div>
</div>
{{/if}}
<div style="display: inline-block;">
<div class="item">{{:helper.link('Clear screen', 'home', {'temp' : 1})}}</div>
</div>
</div>
</div>
{{/if}}