Skip to content

Commit

Permalink
Addresses Brandon's concerns
Browse files Browse the repository at this point in the history
Adds the info missing from directory:
 - Department and/or student level
 - VMACS mobile
 - MIV ID
 - Photo use just the mailid portion of the email
Fixes EmulateUser link
Adds tooltip to buttons
  • Loading branch information
JasonRobertFrancis committed Jul 16, 2024
1 parent 4cef5b7 commit ed1f321
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 59 deletions.
17 changes: 11 additions & 6 deletions web/Areas/Directory/Controllers/DirectoryController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,10 @@ public async Task<ActionResult<IEnumerable<IndividualSearchResult>>> Get(string

var vmsearch = VMACSService.Search(results.Last().LoginId);
var vm = vmsearch.Result;
if (vm != null && vm.item != null && vm.item.Nextel != null && vm.item.LDPager != null)
{
results.Last().Nextel = vm.item.Nextel[0];
results.Last().LDPager = vm.item.LDPager[0];
}
if (vm != null && vm.item != null && vm.item.Nextel != null) results.Last().Nextel = vm.item.Nextel[0];
if (vm != null && vm.item != null && vm.item.LDPager != null) results.Last().LDPager = vm.item.LDPager[0];
if (vm != null && vm.item != null && vm.item.Unit != null) results.Last().Department = vm.item.Unit[0];

});
return results;
}
Expand Down Expand Up @@ -129,7 +128,13 @@ public async Task<ActionResult<IEnumerable<IndividualSearchResult>>> GetUCD(stri
results.Add(hasDetailPermission
? new IndividualSearchResultWithIDs(userInfo, l)
: new IndividualSearchResult(userInfo, l));
};

var vmsearch = VMACSService.Search(results.Last().LoginId);
var vm = vmsearch.Result;
if (vm != null && vm.item != null && vm.item.Nextel != null) results.Last().Nextel = vm.item.Nextel[0];
if (vm != null && vm.item != null && vm.item.LDPager != null) results.Last().LDPager = vm.item.LDPager[0];
if (vm != null && vm.item != null && vm.item.Unit != null) results.Last().Department = vm.item.Unit[0];
};
return results;
}

Expand Down
19 changes: 9 additions & 10 deletions web/Areas/Directory/Models/IndividualSearchResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class IndividualSearchResult
public string ClientId { get; set; } = string.Empty;
public string MothraId { get; set; } = string.Empty;
public string? LoginId { get; set; } = string.Empty;
public string? Email { get; set; } = string.Empty;
public string? MailId { get; set; } = string.Empty;
public string? EmailHost { get; set; } = string.Empty;
public string LastName { get; set; } = string.Empty;
Expand Down Expand Up @@ -57,7 +58,8 @@ public IndividualSearchResult(AaudUser? aaudUser, LdapUserContact? ldapUserConta
if (aaudUser != null) {
MothraId = aaudUser.MothraId;
LoginId = aaudUser.LoginId;
MailId = aaudUser.MailId;
Email = aaudUser.MailId;
MailId = aaudUser.MailId?.Split("@").First();
LastName = aaudUser.LastName;
FirstName = aaudUser.FirstName;
MiddleName = aaudUser.MiddleName;
Expand Down Expand Up @@ -94,7 +96,8 @@ public IndividualSearchResult(AaudUser? aaudUser, LdapUserContact? ldapUserConta
Department = ldapUserContact.Ou;
Phone = ldapUserContact.TelephoneNumber;
Mobile = ldapUserContact.Mobile;
MailId = ldapUserContact.Mail;
Email = ldapUserContact.Mail;
MailId = ldapUserContact.Mail?.Split("@").First();
UserName = ldapUserContact.Uid;
PostalAddress = (ldapUserContact.PostalAddress ?? "").Replace("$", '\n'.ToString());
UCDAffiliation = ldapUserContact.UcdPersonAffiliation;
Expand All @@ -114,15 +117,11 @@ public IndividualSearchResult(AaudUser? aaudUser, LdapUserContact? ldapUserConta
{
if (MailId != null)
{
var split_mailid = MailId.Split('@');
if (split_mailid.Length > 0)
var query = $"SELECT * FROM OPENQUERY(UCDMothra,'SELECT (USERPART || ''@'' || HOSTPART) AS USERATHOST FROM MOTHRA.MAILIDS WHERE MAILID = ''{MailId}'' AND MAILSTATUS = ''A'' AND MAILTYPE = ''P''')".ToString();
var results = context.Database.SqlQuery<string>(FormattableStringFactory.Create(query)).ToList();
foreach (var r in results)
{
var query = $"SELECT * FROM OPENQUERY(UCDMothra,'SELECT (USERPART || ''@'' || HOSTPART) AS USERATHOST FROM MOTHRA.MAILIDS WHERE MAILID = ''{split_mailid[0]}'' AND MAILSTATUS = ''A'' AND MAILTYPE = ''P''')".ToString();
var results = context.Database.SqlQuery<string>(FormattableStringFactory.Create(query)).ToList();
foreach (var r in results)
{
EmailHost = r.Split("@").Last();
}
EmailHost = r.Split("@").Last();
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions web/Areas/Directory/Models/IndividualSearchResultCreator.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Runtime.Versioning;
using Viper.Models.AAUD;
using System.Text.Json;

namespace Viper.Areas.Directory.Models
{
Expand Down Expand Up @@ -40,6 +41,7 @@ public static IndividualSearchResult CreateIndividualSearchResult(AaudUser? aaud

private static void AddAaudUser(IndividualSearchResult indiv, AaudUser aaudUser)
{
indiv.originalObject = JsonSerializer.Serialize(aaudUser);
indiv.MothraId = aaudUser.MothraId;
indiv.LoginId = aaudUser.LoginId;
indiv.MailId = aaudUser.MailId;
Expand Down
5 changes: 3 additions & 2 deletions web/Areas/Directory/Models/IndividualSearchResultWithIDs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ public IndividualSearchResultWithIDs(AaudUser? aaudUser, LdapUserContact? ldapUs
UnexId = aaudUser.UnexId;
MothraId = aaudUser.MothraId;
IamId = aaudUser.IamId;
}
else if(ldapUserContact != null)
MivId = aaudUser.MivId;
}
else if(ldapUserContact != null)
{
Title = ldapUserContact.Title;
Department = ldapUserContact.Ou;
Expand Down
5 changes: 3 additions & 2 deletions web/Areas/Directory/Services/VMACSService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public VMACSService() { }
/// <returns></returns>
public static async Task<VMACSQuery?> Search (String? loginID)
{
string request = $"/trust/query.xml?dbfile=3&index=CampusLoginId&find={loginID}&format=CHRIS4&AUTH=06232005".ToString();

string request = $"/trust/query.xml?dbfile=3&index=CampusLoginId&find={loginID}&format=CHRIS4&AUTH=06232005".ToString();
using HttpResponseMessage response = await sharedClient.GetAsync(request);
if (response.IsSuccessStatusCode == false){
return null;
Expand All @@ -38,7 +39,7 @@ public VMACSService() { }
var serializer = new XmlSerializer(typeof(VMACSQuery));
//return Encoding.ASCII.GetString(stream.ToArray());
var vmacs_api = (VMACSQuery?)serializer.Deserialize(stream);
if (vmacs_api != null && vmacs_api.item != null && vmacs_api.item.Nextel != null)
if (vmacs_api != null && vmacs_api.item != null)
{
return vmacs_api;
}
Expand Down
78 changes: 50 additions & 28 deletions web/Areas/Directory/Views/Card.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,47 @@
<div class="row q-pa-sm q-gutter-sm" id="directoryResults">
<q-card v-for="user in results" class="col-2 col-xs-8 col-sm-5 col-md-8 col-lg-3 col-xl-2 block directory">
<q-card-section class="grid row card_header" :class="[user.svm ? 'SVM' : '']">
<a v-if="user.iamId && user.mothraId" :href="'@HttpHelper.GetOldViperRootURL()/default.cfm?page=userinfo&id='+ user.iamId + '&mothraID=' + user.mothraId" class="userinfo_button"><q-icon name="person" size="xs"></q-icon></a>
<a v-if="user.mailId" :href="'mailto:' + user.mailId + '@@ucdavis.edu'"><q-icon name="email" size="xs" class="email_button"></q-icon></a>
<q-btn icon="assignment_ind" size="xs" dense :href="'/EmulateUser/' + user.loginId" class="emulate_button"></q-btn>
</q-card-section>
<a v-if="user.svm && user.iamId && user.mothraId" :href="'@HttpHelper.GetOldViperRootURL()/default.cfm?page=userinfo&id='+ user.iamId + '&mothraID=' + user.mothraId" class="userinfo_button top_button">
<q-icon name="person" size="xs"></q-icon>
<q-tooltip>User Information</q-tooltip>
</a>
<a v-if="user.mailId" :href="'mailto:' + user.mailId + '@@ucdavis.edu'" class="email_button top_button">
<q-icon name="email" size="xs"></q-icon>
<q-tooltip>Email {{user.mailId}}</q-tooltip>
</a>
<a v-if="user.svm" :href="'@HttpHelper.GetRootURL()/EmulateUser/' + user.loginId" class="emulate_button top_button">
<q-icon name="face" size="xs"></q-icon>
<q-tooltip>Emulate {{user.name}}</q-tooltip>
</a>
<a v-if="ids" :href="'@HttpHelper.GetOldViperRootURL()' + '/default.cfm?Page=AAUDCheck&mothraID=' + user.mothraId + '&loginID=' + user.loginId" class="AAUD_button top_button">
<q-icon name="account_circle" size="xs"></q-icon>
<q-tooltip>AAUD Check</q-tooltip>
</a>
<a v-if="ids" :href="'@HttpHelper.GetOldViperRootURL()' + '/default.cfm?Page=IDCardCheck&LoginID=' + user.loginId" v-if="ids" class="ID_button top_button">
<q-icon name="account_box" size="xs"></q-icon>
<q-tooltip>ID Check</q-tooltip>
</a>
<a :href="'@HttpHelper.GetOldViperRootURL()' + '/default.cfm?Page=UnitHeads&MailID=' + user.mailId" v-if="ids" class="MSO_button top_button">
<q-icon name="supervisor_account" size="xs"></q-icon>
<q-tooltip>MSO/CAO Lookup</q-tooltip>
</a>
@if (UserHelper.HasPermission(rapsContext, UserHelper.GetCurrentUser(), "SVMSecure.DirectoryUCPathInfo"))
{
@:
<a :href="'@HttpHelper.GetOldViperRootURL()' + '/default.cfm?Page=UCPathInfo&emplid=' + user.employeeId" v-if="ids && user.employeeId" class="UCPath_button top_button">
<q-icon name="school" size="sm"></q-icon>
<q-tooltip>UCPath Info</q-tooltip>
</a>
}
@if (UserHelper.HasPermission(rapsContext, UserHelper.GetCurrentUser(), "SVMSecure.CATS.ServiceDesk"))
{
@:
<a :href="'@HttpHelper.GetOldViperRootURL()' + '/default.cfm?Page=alternatePhoto&iamID' + user.iamId + '&mailID=' + props.row.mailId + '&empName=' + user.name" v-if="ids && user.currentAffiliate" class="photo_button top_button">
<q-icon name="photo_camera" size="xs"></q-icon>
<q-tooltip>Alt. Photo</q-tooltip>
</a>
}
</q-card-section>
<q-card-section class="row">
<q-card-section class="col photo">
<q-avatar size="87px" square class="text-right photo_avatar">
Expand All @@ -49,23 +86,24 @@
<h5 v-if="user.userName">{{user.userName}}</h5>
<h1>{{user.name}}</h1>
<h2 v-if="user.title">{{user.title}}</h2>
<h2 v-if="user.department">{{user.department}}</h2>
<h3 v-if="user.ucdStudentLevel">{{user.ucdStudentLevel}}</h3>
<h4 v-if="user.svm && ucd">SVM</h4>
<div class="contact">
<div class="mail" v-if="user.mailId"><a href="mailto:{{user.mailId}}">{{user.mailId}}</a></div>
<div class="mail" v-if="user.email"><a :href="'mailto:' + user.email">{{user.email}}</a></div>
<div class="host" v-if="ids && user.emailHost">[{{user.emailHost}}]</div>
<div class="phone" v-if="user.phone">Ph: {{ user.phone }}</div>
<div class="mobile" v-if="user.mobile">M: {{ user.mobile }}</div>
<div class="nextel" v-if="user.ldpager">Pager: {{ user.ldpager }}</div>
<div class="nextel" v-if="user.nextel">N: {{ user.nextel }}</div>
<div class="nextel" v-if="user.nextel">M: {{ user.nextel }} (VMACS)</div>
<div class="address" v-if="user.postalAddress">{{ user.postalAddress }}</div>
</div>
</q-card-section>
</q-card-section>
<q-separator v-if="ids && (user.spridentId || user.pidm || user.employeeId || user.iamId || user.mothraId || user.mivId)"></q-separator>
<q-card-section class="row ids" v-if="ids && (user.spridentId || user.pidm || user.employeeId || user.iamId || user.mothraId || user.mivId)">
<div v-if="user.spridenId">
BannerID:
<span>BannerID:</span>
@if (UserHelper.HasPermission(rapsContext, UserHelper.GetCurrentUser(), "SVMSecure.SIS.AllStudents"))
{
@: <a :href="'@HttpHelper.GetOldViperRootURL()' + '/students/sis/default.cfm?Page=AssignPidmAndRedirect&Pidm=' + user.spridenId + '&JumpPage=Home'">{{ user.spridenId }}</a>
Expand All @@ -75,27 +113,11 @@
@: {{ user.spridenId }}
}
</div>
<div v-if="user.pidm">PIDM: {{ user.pidm }}</div>
<div v-if="user.employeeId">EmployeeID: {{ user.employeeId}}</div>
<div v-if="user.iamId">IAMID: {{ user.iamId }}</div>
<div v-if="user.mothraId">MothraID: {{ user.mothraId }}</div>
<div v-if="user.mivId > 0">MIVID: {{ user.mivId }}</div>
</q-card-section>
<q-separator v-if="ids"></q-separator>
<q-card-section class="row tools" style="font-size:90%;" v-if="ids">
<div><a :href="'@HttpHelper.GetOldViperRootURL()' + '/default.cfm?Page=AAUDCheck&mothraID=' + user.mothraId + '&loginID=' + user.loginId">AAUD Check</a></div>
<div><a :href="'@HttpHelper.GetOldViperRootURL()' + '/default.cfm?Page=IDCardCheck&LoginID=' + user.loginId">ID Check</a></div>
<div><a :href="'@HttpHelper.GetOldViperRootURL()' + '/default.cfm?Page=UnitHeads&MailID=' + user.mailId">MSO/CAO Lookup</a></div>
@if (UserHelper.HasPermission(rapsContext, UserHelper.GetCurrentUser(), "SVMSecure.DirectoryUCPathInfo"))
{
@:
<div v-if="user.employeeId != ''"><a :href="'@HttpHelper.GetOldViperRootURL()' + '/default.cfm?Page=UCPathInfo&emplid=' + user.employeeId">UCPath Info</a></div>
}
@if (UserHelper.HasPermission(rapsContext, UserHelper.GetCurrentUser(), "SVMSecure.CATS.ServiceDesk"))
{
@:
<dv v-if="user.currentAffiliate == true"><a :href="'@HttpHelper.GetOldViperRootURL()' + '/default.cfm?Page=alternatePhoto&iamID' + user.iamId + '&mailID=' + props.row.mailId + '&empName=' + user.name">Alt. Photo</a></dv>
}
<div v-if="user.pidm"><span>PIDM:</span> {{ user.pidm }}</div>
<div v-if="user.employeeId"><span>EmployeeID:</span> {{ user.employeeId}}</div>
<div v-if="user.iamId"><span>IAMID:</span> {{ user.iamId }}</div>
<div v-if="user.mothraId"><span>MothraID:</span> {{ user.mothraId }}</div>
<div v-if="user.mivId"><span>MIVID:</span> {{ user.mivId }}</div>
</q-card-section>
<q-separator v-if="debug"></q-separator>
<q-card-section v-if="debug">
Expand Down
34 changes: 23 additions & 11 deletions web/wwwroot/css/directory.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@
.directory .contact div, .directory .ids div, .directory .tools div {
flex: 0 0 95%;
}
.directory .ids div {
font-weight: bold;
}
.directory .ids div span {
font-weight: normal;
display: inline-block;
width: 85px;
text-align: right;
margin-right: 0;
}
.directory .contact {
margin-top: 1em;
}
Expand All @@ -43,6 +53,7 @@
max-width: 87px !important;
padding: 2px;
margin: 0;
margin-top: 22px;
}

.directory .photo_avatar {
Expand Down Expand Up @@ -75,14 +86,15 @@
.directory h5 {
font-size: 10px;
}
.directory .userinfo_button, .directory .email_button {
color: #fff;
padding: 8px;
}
.directory .emulate_button {
color: #fff;
border: none;
}
.directory .emulate_button:before {
box-shadow: none;
}
.directory .top_button {
color: #fff;
text-align: center;
line-height: 40px;
height: 40px;
width: 12%;
max-width: 40px;
color: #a4b5c8;
}
.directory .top_button:hover {
color: #fff;
}

0 comments on commit ed1f321

Please sign in to comment.