Skip to content

Commit

Permalink
Addresses #154 Remove unused CRMS.pm functions
Browse files Browse the repository at this point in the history
- Touches a lot of files, but these are all code removals.
  • Loading branch information
moseshll committed Nov 5, 2024
1 parent 7f8b261 commit ab2e6d6
Show file tree
Hide file tree
Showing 25 changed files with 22 additions and 103 deletions.
55 changes: 4 additions & 51 deletions cgi/CRMS.pm
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ sub WebPath
$fullpath = ($type eq 'web')? ("/c/crms/". $path): ("/$type/c/crms/". $path);
}
#print "$fullpath ($type, $path)\n";
return $self->Sysify($fullpath);
return $fullpath;
}

# The href or URL to use.
Expand Down Expand Up @@ -3445,7 +3445,7 @@ sub LinkToReview

$title = $self->GetTitle($id) unless $title;
$title = CGI::escapeHTML($title);
my $url = $self->Sysify($self->WebPath('cgi', "crms?p=review;htid=$id;editing=1"));
my $url = $self->WebPath('cgi', "crms?p=review;htid=$id;editing=1");
$url .= ";importUser=$user" if $user;
$self->ClearErrors();
return "<a href='$url' target='_blank'>$title</a>";
Expand Down Expand Up @@ -5762,34 +5762,6 @@ sub CountCorrectReviews
return ($correct, $incorrect, $neutral);
}

# Gets only those reviewers that are not experts
sub GetType1Reviewers
{
my $self = shift;

my $sql = 'SELECT id FROM users WHERE id NOT LIKE "rereport%" AND expert=0';
return map {$_->[0]} @{ $self->SelectAll($sql) };
}

sub GetValidation
{
my $self = shift;
my $start = shift;
my $end = shift;
my $users = shift;

# FIXME: what purpose does GetType1Reviewers serve here?
$users = sprintf '"%s"', join '","', $self->GetType1Reviewers() unless $users;
$start = substr($start,0,7);
$end = substr($end,0,7);
my $sql = 'SELECT SUM(total_reviews),SUM(total_correct),SUM(total_incorrect),SUM(total_neutral) FROM userstats' .
" WHERE monthyear>=? AND monthyear<=? AND user IN ($users)";
#print "$sql<br/>\n";
my $ref = $self->SelectAll($sql, $start, $end);
my $row = $ref->[0];
return @{ $row };
}

sub ReviewSearchMenu
{
my $self = shift;
Expand Down Expand Up @@ -6440,7 +6412,7 @@ sub LinkNoteText

if ($note =~ m/See\sall\sreviews\sfor\sSys\s#(\d+)/)
{
my $url = $self->Sysify($self->WebPath('cgi', "crms?p=adminHistoricalReviews;stype=reviews;search1=SysID;search1value=$1"));
my $url = $self->WebPath('cgi', "crms?p=adminHistoricalReviews;stype=reviews;search1=SysID;search1value=$1");
$note =~ s/(See\sall\sreviews\sfor\sSys\s#)(\d+)/$1<a href="$url" target="_blank">$2<\/a>/;
}
return $note;
Expand Down Expand Up @@ -6851,7 +6823,7 @@ sub AddInheritanceToQueue
my $n = $self->SimpleSqlGet($sql, $id);
if ($n)
{
my $url = $self->Sysify("?p=adminReviews;search1=Identifier;search1value=$id");
my $url = "?p=adminReviews;search1=Identifier;search1value=$id";
my $msg = sprintf "already has $n <a href='$url' target='_blank'>%s</a>", $self->Pluralize('review',$n);
push @msgs, $msg;
$stat = 1;
Expand Down Expand Up @@ -7425,16 +7397,6 @@ sub Authorities
return \@all;
}

# Previously used to make sure viral params were appended to generated URLs.
# No longer needed -- can be removed.
sub Sysify
{
my $self = shift;
my $url = shift;

return $url;
}

# Used to simplify the search results page links.
# Makes URL params for all values defined in the CGI,
# ignoring those that are valueless.
Expand Down Expand Up @@ -7476,15 +7438,6 @@ sub Hiddenify
return join "\n", @comps;
}

# Previously used to make sure viral params were included in hidden input.
# No longer needed -- can be removed.
sub HiddenSys
{
my $self = shift;

return '';
}

# Compares 2 strings or undefs. Returns 1 or 0 for equality.
sub TolerantCompare
{
Expand Down
7 changes: 2 additions & 5 deletions cgi/adminQueue.tt
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ function CheckAll(box,formid)
<br/><br/>
[% locked = crms.GetLockedItems() %]
[% IF locked.size %]
[% url = crms.Sysify('crms?p=adminQueue;clear=1') %]
<blockquote><a href="$url">Clear old locks</a></blockquote><br/>
<blockquote><a href="crms?p=adminQueue;clear=1">Clear old locks</a></blockquote><br/>
<form action="crms" id="checks">
[% crms.HiddenSys() %]
<input type="hidden" name="p" value="adminQueue"/>
<input type="checkbox" id="SelectAllCB" onclick="CheckAll(this,'checks');"/>
<label for="SelectAllCB">Select All</label>&nbsp;&nbsp;&nbsp;&nbsp;
Expand All @@ -60,8 +58,7 @@ function CheckAll(box,formid)
<td style="text-align:center">[% locked.${item}.locked %]</td>
<td style="text-align:center"><input type="checkbox" name="vol_[% item %]"/></td>
<td style="text-align:center">
[% url = crms.Sysify("crms?p=adminQueue;unlock=$item") %]
<a href="$url">do it</a>
<a href="crms?p=adminQueue;unlock=[% item %]"">do it</a>
</td>
</tr>
[% END %]
Expand Down
5 changes: 1 addition & 4 deletions cgi/adminUser.tt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ addEvent(window, 'load', function(e)

<form action="crms">
<input type="hidden" name="p" value="adminUser"/>
[% crms.HiddenSys() %]
<label for="order">Order by:</label>
<select name="order" id="order" onchange="this.form.submit()">
<option value="0" [% (order==0)? 'selected="selected"':'' %]>Name</option>
Expand Down Expand Up @@ -94,12 +93,11 @@ addEvent(window, 'load', function(e)
[% style = (active)? '':'style="background-color:#e2e2e2;"' %]
<tr [% id == u.id ? 'class="total"':'class="hoverWide"'%] [% style %]>
<td class="nowrap">
<a href="[% crms.Sysify('crms?p=userRate;user=' _ userid) %]" target="_blank">
<a href="crms?p=userRate;user=[% userid %]" target="_blank">
[% u.name.replace('\s','&nbsp;') %]
</a>
[% IF active && crms.CanChangeToUser(user,userid) %]
<form action="crms" style="display:inline;align:right;">
[% crms.HiddenSys() %]
<input type="hidden" name="changeuser" value="1"/>
<input type="hidden" name="newuser" value="[% userid %]"/>
<input type="submit" value="Change to…"/>
Expand Down Expand Up @@ -195,7 +193,6 @@ addEvent(window, 'load', function(e)
<input type="hidden" name="p" value="adminUser"/>
<input type="hidden" name="add" value="1"/>
<input type="hidden" name="order" value="[% order %]"/>
[% crms.HiddenSys() %]
<table>
<tr>
<td>
Expand Down
1 change: 0 additions & 1 deletion cgi/adminUserRate.tt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<div style="position:relative;border-style:solid;width:36em;border-width:1px;padding:10px;">
<form id="select" action="crms">
<input type="hidden" name="p" value="$p_page"/>
[% crms.HiddenSys() %]

[% projs = crms.GetProjectsRef() %]
<label for="projectSel" style="width:5em;float:left;">Project</label>
Expand Down
1 change: 0 additions & 1 deletion cgi/bib_rights.tt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

<h2>Query Bibliographic Rights:</h2>
<form action="crms">
[% crms.HiddenSys() %]
<input type="hidden" name="p" value="[% p %]"/>
<label for="queryTA" class="smallishText">Enter one volume or catalog id per line.</label><br/>
<textarea id="queryTA" name="query" cols="20" rows="10" style="width:33%; height:9em;">[% crms.EchoInput(q) %]</textarea>
Expand Down
1 change: 0 additions & 1 deletion cgi/candidates.tt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@

<form id="select" action="crms">
<input type="hidden" name="p" value="$page"/>
[% crms.HiddenSys() %]

Restrict selection:<br/>

Expand Down
5 changes: 0 additions & 5 deletions cgi/debug.tt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<th>List&nbsp;Unicode&nbsp;bibdata&nbsp;entries</th>
<td>
<form action="crms">
[% crms.HiddenSys() %]
<input type="hidden" name="p" value="$page"/>
<input type="hidden" name="multibyte" value="1"/>
<input type="submit" value="Do it!"/>
Expand All @@ -22,7 +21,6 @@
<th>List&nbsp;System&nbsp;variables</th>
<td>
<form action="crms">
[% crms.HiddenSys() %]
<input type="hidden" name="p" value="$page"/>
<input type="hidden" name="systemvars" value="1"/>
<input type="submit" value="Do it!"/>
Expand All @@ -47,7 +45,6 @@
<div style="position:relative;border-style:solid;width:66em;border-width:1px;padding:10px;">
<h3>Export Report</h3>
<form id="select" action="crms">
[% crms.HiddenSys() %]
<input type="hidden" name="p" value="$page"/>
<input type="hidden" name="export_report" value="1"/>
<label for="startDate" style="width:5em;float:left;">YTD Start:</label>
Expand Down Expand Up @@ -135,7 +132,6 @@
[% ids = cgi.param('ids') %]
<h4>Update Bibliographic Data</h4>
<form action="crms">
[% crms.HiddenSys() %]
<input type="hidden" name="p" value="debug"/>
<input type="hidden" name="fix" value="1"/>
<p class="smallishText">Enter one volume id per line.</p>
Expand All @@ -149,7 +145,6 @@
<div style="position:relative;border-style:solid;width:76em;border-width:1px;padding:10px;">
<h4>Remove From Candidates</h4>
<form action="crms">
[% crms.HiddenSys() %]
<input type="hidden" name="p" value="debug"/>
<input type="hidden" name="deleteFromCandidates" value="1"/>
<p class="smallishText">Enter one volume id per line.</p>
Expand Down
4 changes: 2 additions & 2 deletions cgi/denied.tt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
[% username = (user)? user : "{unknown user}" %]
<h2>You do not have access to this page.</h2>
[% IF user %]
<strong><a href="[% crms.Sysify('?p=home') %]">Go to home page</a></strong><br/>
<strong><a href="[% crms.Sysify('?p=Logout') %]"> Logout</a></strong>
<strong><a href="?p=home">Go to home page</a></strong><br/>
<strong><a href="?p=Logout"> Logout</a></strong>
[% END %]
<div class="warningSubbox">
<h4>Security considerations do not allow Copyright Review Management System reviewer
Expand Down
2 changes: 1 addition & 1 deletion cgi/expired.tt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
[% user = crms.get('user') %]
<div class="warningBox">
<h2>Hello [% crms.GetUserProperty(user, 'name') %]. You do not have access to this site.</h2>
<strong><a href="[% crms.Sysify('?p=Logout') %]"> Logout</a></strong>
<strong><a href="?p=Logout"> Logout</a></strong>

<div class="warningSubbox">
<h4>Your access to in-copyright HathiTrust scans expired [% exp.expires %].
Expand Down
1 change: 0 additions & 1 deletion cgi/exportDataSelection.tt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

<form id="select" action="crms">
<input type="hidden" name="p" value="$page"/>
[% crms.HiddenSys() %]

Restrict selection:<br/>

Expand Down
6 changes: 3 additions & 3 deletions cgi/header.tt
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
[% status = (r.1 == 'down')? 'unavailable':((r.1 == 'partial')? 'partially available':r.1) %]
<span style="font-size:1.3em;text-align:center;color:#DD4444">System status is <b>[% status %]</b>; last modified [% r.0 %]</span><br/>
<span style="font-size:1.1em;">[% r.2 %]</span>
[% IF page == 'review' %]&nbsp;&nbsp;&nbsp;<a href="[% crms.Sysify('crms') %]">Home</a>[% END %]
[% IF page == 'review' %]&nbsp;&nbsp;&nbsp;<a href="crms">Home</a>[% END %]
</td></tr>
</table>
[% ELSE %]
<a href="[% crms.Sysify('crms') %]">
<a href="crms">
<img src="[% crms.WebPath('web', crms.GetSystemVar('logo')) %]" width="455" height="80" alt="Jump to home page"
style="float:left;border:0px solid;margin-right:4em;"/>
</a>
Expand All @@ -64,7 +64,7 @@
</td>
<td style="line-height:1px;">
Hello&nbsp;[% crms.GetUserProperty(undef, 'name').replace(" ","&nbsp;") %]&nbsp;&nbsp;
<a href="[% crms.Sysify(crms.WebPath('cgi', 'crms?p=Logout')) %]" class="header">Log Out</a>
<a href="[% crms.WebPath('cgi', 'crms?p=Logout') %]" class="header">Log Out</a>
</td>
</tr>
<tr>
Expand Down
7 changes: 2 additions & 5 deletions cgi/home.tt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ function CheckAll(box,formid)
[% IF projs.size > 1 %]
<form action="crms">
<input type="hidden" name="projectForm" value="1"/>
[% crms.HiddenSys() %]
<label for="projectSel">Current project:</label>
<select name="projectSel" id="projectSel" onchange="this.form.submit()">
[% FOREACH proj IN projs %]
Expand All @@ -52,8 +51,7 @@ function CheckAll(box,formid)
[% n = ref.size %]
[% IF n>0 %]
<h4>You have $n
<a href="[% crms.Sysify('?p=queueAdd') %]">
high-priority</a> [% crms.Pluralize('volume', n) %].
<a href="?p=queueAdd">high-priority</a> [% crms.Pluralize('volume', n) %].
</h4>
[% END %]
<br/>
Expand Down Expand Up @@ -118,7 +116,6 @@ function CheckAll(box,formid)
[% IF locked.size %]
[% sysStatus = crms.GetSystemStatus().1 %]
<br/><br/><form action="crms" id="checks">
[% crms.HiddenSys() %]
<input type="checkbox" id="SelectAllCB" onclick="CheckAll(this,'checks');"/>
<label for="SelectAllCB">Select All</label>&nbsp;&nbsp;&nbsp;&nbsp;
[% IF sysStatus == 'normal' %]
Expand All @@ -135,7 +132,7 @@ function CheckAll(box,formid)
<td>[% crms.GetTitle( item ) %]</td>
<td style="text-align:center"><input type="checkbox" name="vol_[% item %]"/></td>
<td style="text-align:center">
[% IF sysStatus == 'normal' %]<a href="[% crms.Sysify("crms?unlock=" _ item) %]">do it</a>[% END %]
[% IF sysStatus == 'normal' %]<a href="crms?unlock=[% item %]">do it</a>[% END %]
</td>
</tr>
[% END %]
Expand Down
2 changes: 0 additions & 2 deletions cgi/inherit.tt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ may not be up-to-date.</h3>
<input type="hidden" name="p" value="$p"/>
<input type="hidden" name="auto" value="$auto"/>
<input type="hidden" name="n" value="$n"/>
[% crms.HiddenSys() %]

Restrict selection:
<div style="position:absolute;top:0.5em;right:0.5em;">
Expand Down Expand Up @@ -229,7 +228,6 @@ function EnableButtons(formid)
<input type="hidden" name="p" value="$p"/>
<input type="hidden" name="auto" value="$auto"/>
<input type="hidden" name="n" value="$n"/>
[% crms.HiddenSys() %]
<input type="checkbox" id='SelectAllButton' onclick="CheckAll(this,'checks');"/>
<label for="SelectAllButton">Select All</label>
&nbsp;&nbsp;&nbsp;&nbsp;
Expand Down
4 changes: 1 addition & 3 deletions cgi/institutions.tt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

<form action="crms">
<input type="hidden" name="p" value="institutions"/>
[% crms.HiddenSys() %]
<label for="order">Order by:</label>
<select name="order" id="order" onchange="this.form.submit()">
<option value="id" [% (order=='id')? 'selected="selected"':'' %]>ID</option>
Expand Down Expand Up @@ -49,7 +48,7 @@
<tr [% id == iid ? 'class="total"':'class="hoverWide"'%] [% style %]>
<td>[% id %]</td>
<td class="nowrap">
<a href="[% crms.Sysify('crms?p=adminUserRate;institution=' _ id) %]">
<a href="crms?p=adminUserRate;institution=[% id %]">
[% inst.name.replace('\s','&nbsp;') %]
</a>
</td>
Expand All @@ -73,7 +72,6 @@
<input type="hidden" name="p" value="institutions"/>
<input type="hidden" name="add" value="1"/>
<input type="hidden" name="order" value="[% order %]"/>
[% crms.HiddenSys() %]
<table>
<tr>
<td>
Expand Down
1 change: 0 additions & 1 deletion cgi/keio.tt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ addEvent(window, 'load', function(e)
[% END %]
<form action="crms">
<input type="hidden" name="p" value="keio"/>
[% crms.HiddenSys() %]
<label for="table_sel">Table:</label>
<select name="table" id="table_sel" onchange="selMenuItem('query_sel', 0);selMenuItem('page_sel', 0);this.form.submit()">
<option value=""></option>
Expand Down
2 changes: 0 additions & 2 deletions cgi/licensing.tt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

<h2>Licensing:</h2>
<form action="crms">
[% crms.HiddenSys() %]
<input type="hidden" name="p" value="[% p %]"/>
<label for="queryTA" class="smallishText">Enter one volume or system id per line.</label><br/>
<textarea id="queryTA" name="query" cols="20" rows="10" style="width:33%; height:9em;">[% crms.EchoInput(q) %]</textarea>
Expand All @@ -14,7 +13,6 @@

[% IF q %]
<form action="crms" method="POST">
[% crms.HiddenSys() %]
<input type="hidden" name="p" value="[% p %]"/>
[% IF cgi.param("submit_rights") == "true" %]
<br/><strong>Data Submitted</strong><br/>
Expand Down
1 change: 0 additions & 1 deletion cgi/mail.tt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ function closeMe()
<br/>
[% user = crms.get('user') %]
<form action="crms">
[% crms.HiddenSys() %]
<input type="hidden" name="user" value="[% user %]"/>
<input type="hidden" name="p" value="[% cgi.param('p') %]"/>
<input type="hidden" name="uuid" value="[% crms.UUID() %]"/>
Expand Down
2 changes: 1 addition & 1 deletion cgi/nav.tt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ addEvent(window, 'load', sfHover);
[% IF p %]
<li><span>Home</span>
<dl class="home">
<dt><a href="[% crms.Sysify("crms") %]">Home</a></dt>
<dt><a href="crms"">Home</a></dt>
<dd style="display:none"> </dd>
</dl>
</li>
Expand Down
2 changes: 1 addition & 1 deletion cgi/partial/top.tt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<tr>
<td style="text-align:left;padding-left:8px;">
<a href="[% homeLink %]">Home</a>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="[% crms.Sysify(crms.WebPath('cgi', 'crms?p=Logout')) %]">Logout</a>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="[% crms.WebPath('cgi', 'crms?p=Logout') %]">Logout</a>
</td>
</tr>
<tr>
Expand Down
Loading

0 comments on commit ab2e6d6

Please sign in to comment.