diff --git a/cgi/CRI.pm b/cgi/CRI.pm deleted file mode 100644 index 215734c0..00000000 --- a/cgi/CRI.pm +++ /dev/null @@ -1,586 +0,0 @@ -package CRI; -use vars qw(@ISA @EXPORT @EXPORT_OK); - -use strict; -use warnings; -use CGI; - -sub new -{ - my ($class, %args) = @_; - my $self = bless {}, $class; - my $errors = []; - $self->set('errors', $errors); - my $crms = $args{'crms'}; - die "Metadata module needs CRMS instance." unless defined $crms; - $self->set('crms', $crms); - return $self; -} - -sub get -{ - my $self = shift; - my $key = shift; - - return $self->{$key}; -} - -sub set -{ - my $self = shift; - my $key = shift; - my $val = shift; - - delete $self->{$key} unless defined $val; - $self->{$key} = $val if defined $key and defined $val; -} - -sub SetError -{ - my $self = shift; - my $error = shift; - - $self->get('crms')->SetError($error); -} - -sub GetUser -{ - my $self = shift; - my $error = shift; - - $self->get('crms')->get('user'); -} - -sub GetReviewsRef -{ - my $self = shift; - my $gid = shift; - my $pubDate = shift; - - my $crms = $self->get('crms'); - my @results; - my $sql = 'SELECT r.id,r.user,r.attr,r.reason,r.note,r.category,r.renDate,r.renNum FROM historicalreviews r'. - ' INNER JOIN users u ON r.user=u.id WHERE r.gid=?'. - ' AND (r.category IS NULL OR category!="Expert Accepted")'. - ' ORDER BY u.expert DESC,u.advanced DESC, u.id ASC'; - my $ref = $crms->SelectAll($sql, $gid); - foreach my $row (@{$ref}) - { - my $data = {'id' => $row->[0], - 'user' => $row->[1], - 'attr' => $crms->TranslateAttr($row->[2]), - 'reason' => $crms->TranslateReason($row->[3]), - 'note' => $row->[4], - 'category' => $row->[5], - 'renDate' => $row->[6], - 'renNum' => $row->[7]}; - #my $rid = $crms->PredictRights($row->[0], $row->[6], $row->[7], $row->[5], undef, $pubDate); - #my $pa = $crms->TranslateAttr($crms->SimpleSqlGet("SELECT attr FROM rights WHERE id=$rid")); - #my $pr = $crms->TranslateReason($crms->SimpleSqlGet("SELECT reason FROM rights WHERE id=$rid")); - #$data->{'attr'} = $pa; - #$data->{'reason'} = $pr; - push @results, $data; - } - return \@results; -} - -sub GetNextVolumeForReview -{ - my $self = shift; - my $user = shift || $self->GetUser(); - - my $crms = $self->get('crms'); - my $sql = 'SELECT c.id FROM cri c INNER JOIN bibdata b ON c.id=b.id'. - ' WHERE c.locked IS NULL AND c.status IS NULL ORDER BY b.author ASC,b.title ASC'; - my $ref = $crms->SelectAll($sql); - my ($id, $gid); - foreach my $row (@{$ref}) - { - my $id2 = $row->[0]; - my $err = $self->LockItem($id2, $user); - if (!$err) - { - $id = $id2; - last; - } - } - return $id; -} - -sub GetGID -{ - my $self = shift; - my $id = shift; - my $user = shift || $self->GetUser(); - - my $crms = $self->get('crms'); - my $sql = 'SELECT gid FROM cri WHERE id=? AND locked=?'; - return $crms->SimpleSqlGet($sql, $id, $user); -} - -sub HasLockedItem -{ - my $self = shift; - my $user = shift || $self->GetUser(); - - my $crms = $self->get('crms'); - my $sql = 'SELECT COUNT(*) FROM cri WHERE locked=? LIMIT 1'; - return ($crms->SimpleSqlGet($sql, $user))? 1:0; -} - -# Returns 0 on success, error message on error. -sub LockItem -{ - my $self = shift; - my $id = shift; - my $user = shift || $self->GetUser(); - - my $crms = $self->get('crms'); - ## if already locked for this user, that's OK - return 0 if $self->IsLockedForUser($id, $user); - # Not locked for user, maybe someone else - if ($self->IsLocked($id)) - { - return 'Volume has been locked by another user'; - } - ## can only have 1 item locked at a time (unless override) - my $locked = $self->GetLockedItem($user); - if (defined $locked) - { - return 0 if $locked eq $id; - return "You already have a locked item ($locked)."; - } - my $sql = 'UPDATE cri SET locked=? WHERE id=?'; - $crms->PrepareSubmitSql($sql, $user, $id); - #$crms->Note("Lock $id for $user"); - return 0; -} - -sub IsLockedForUser -{ - my $self = shift; - my $id = shift; - my $user = shift || $self->GetUser(); - - my $crms = $self->get('crms'); - my $sql = 'SELECT COUNT(*) FROM cri WHERE id=? AND locked=?'; - return 1 == $crms->SimpleSqlGet($sql, $id, $user); -} - -sub IsLockedForOtherUser -{ - my $self = shift; - my $id = shift; - my $user = shift || $self->GetUser(); - - my $crms = $self->get('crms'); - my $lock = $crms->SimpleSqlGet('SELECT locked FROM cri WHERE id=?', $id); - return ($lock && $lock ne $user)? $lock:undef; -} - -sub GetLockedItem -{ - my $self = shift; - my $user = shift || $self->GetUser(); - - my $crms = $self->get('crms'); - my $sql = 'SELECT id,gid FROM cri WHERE locked=? LIMIT 1'; - return $crms->SimpleSqlGet($sql, $user); -} - -sub IsLocked -{ - my $self = shift; - my $id = shift; - - my $crms = $self->get('crms'); - my $sql = 'SELECT id FROM cri WHERE locked IS NOT NULL AND id=?'; - return ($crms->SimpleSqlGet($sql, $id))? 1:0; -} - -sub UnlockItem -{ - my $self = shift; - my $id = shift; - my $user = shift || $self->GetUser(); - - my $crms = $self->get('crms'); - my $sql = 'UPDATE cri SET locked=NULL WHERE id=? AND locked=?'; - $crms->PrepareSubmitSql($sql, $id, $user); -} - -sub LinkToReview -{ - my $self = shift; - my $id = shift; - my $text = shift; - #my $user = shift; - - my $crms = $self->get('crms'); - $text = CGI::escapeHTML($text); - my $url = $crms->WebPath('cgi', "crms?p=cri;htid=$id;editing=1"); - #$url .= ";importUser=$user" if $user; - #$self->ClearErrors(); - return "$text"; -} - -# Used by the getCRIInfo CGI for updating the interface via AJAX -sub GetCRIInfo -{ - my $self = shift; - my $id = shift; - - my $crms = $self->get('crms'); - my %data; - my $sql = 'SELECT locked,status from cri WHERE id=?'; - my $ref = $crms->SelectAll($sql, $id); - $data{'locked'} = $ref->[0]->[0]; - $data{'status'} = $ref->[0]->[1]; - return \%data; -} - -my @FieldNames = ('Volume ID', 'GID', 'Source Status', 'Determination', - 'Locked', 'Status', 'Author', 'Title', 'Pub Date'); -my @Fields = qw(id gid source_status determination - locked status author title pubdate); -my @DBFields = ('c.id', 'c.gid', 'e.status', 'CONCAT(e.attr,"/",e.reason)', - 'c.locked', 'c.status', 'b.author', 'b.title', 'b.pub_date'); -# Map from @Field to @DBFields -my %FieldMap; -$FieldMap{$Fields[$_]} = $DBFields[$_] for (0 .. scalar @Fields - 1); - -sub Titles -{ - return \@FieldNames; -} - -sub Fields -{ - return \@Fields; -} - -sub DataRef -{ - my $self = shift; - my $order = shift; - my $dir = shift; - my $search1 = shift; - my $search1Value = shift; - my $op1 = shift; - my $search2 = shift; - my $search2Value = shift; - my $offset = shift; - my $pagesize = shift; - - my $crms = $self->get('crms'); - $pagesize = 20 unless $pagesize and $pagesize > 0; - $offset = 0 unless $offset and $offset > 0; - $order = $FieldMap{$order} if $order; - $order = 'b.author' unless $order; - $offset = 0 unless $offset; - my @rest = ('c.exported=0'); - my $tester1 = '='; - my $tester2 = '='; - if ($search1Value =~ m/.*\*.*/) - { - $search1Value =~ s/\*/%/gs; - $tester1 = ' LIKE '; - } - if ($search2Value =~ m/.*\*.*/) - { - $search2Value =~ s/\*/%/gs; - $tester2 = ' LIKE '; - } - if ($search1Value =~ m/([<>!]=?)\s*(\d+)\s*/) - { - $search1Value = $2; - $tester1 = $1; - } - if ($search2Value =~ m/([<>!]=?)\s*(\d+)\s*/) - { - $search2Value = $2; - $tester2 = $1; - } - if ($search1Value ne '' && $search2Value ne '') - { - push @rest, "($search1 $tester1 '$search1Value' $op1 $search2 $tester2 '$search2Value')"; - } - else - { - $search1 = $FieldMap{$search1} if $search1; - $search2 = $FieldMap{$search2} if $search2; - push @rest, "$search1 $tester1 '$search1Value'" if $search1Value ne ''; - push @rest, "$search2 $tester2 '$search2Value'" if $search2Value ne ''; - } - my $restrict = ((scalar @rest)? 'WHERE ':'') . join(' AND ', @rest); - my $sql = 'SELECT COUNT(*) FROM cri c INNER JOIN bibdata b ON c.id=b.id'. - ' INNER JOIN exportdata e ON e.gid=c.gid '. $restrict; - #print "$sql
\n"; - my $totalVolumes = $crms->SimpleSqlGet($sql); - $offset = $totalVolumes-($totalVolumes % $pagesize) if $offset >= $totalVolumes; - my $limit = "LIMIT $offset, $pagesize"; - my @return = (); - my $concat = join ',', @DBFields; - $sql = "SELECT $concat FROM cri c INNER JOIN bibdata b ON c.id=b.id". - " INNER JOIN exportdata e ON e.gid=c.gid $restrict ORDER BY $order $dir $limit"; - #print "$sql
\n"; - my $ref = undef; - eval { - $ref = $crms->SelectAll($sql); - }; - if ($@) - { - $self->SetError($@); - } - foreach my $row (@{$ref}) - { - my %item = (); - $item{$Fields[$_]} = $row->[$_] for (0 ... scalar @Fields-1); - $item{'pubdate'} = $crms->FormatPubDate($row->[0]); - push @return, \%item; - - } - my $n = POSIX::ceil($offset/$pagesize+1); - my $of = POSIX::ceil($totalVolumes/$pagesize); - $n = 0 if $of == 0; - my $data = {'rows' => \@return, - 'volumes' => $totalVolumes, - 'page' => $n, - 'of' => $of - }; - return $data; -} - -# Can edit if it has NULL status, or if numeric and the user is the one who reviewed it, -# but only if it is unexported. Rejected CRI can be edited by anyone because -# we don't keep a record of who did the rejection (no corresponding queue entry). -sub CanEditCri -{ - my $self = shift; - my $id = shift; - my $user = shift || $self->GetUser(); - - my $crms = $self->get('crms'); - my $sql = 'SELECT status FROM cri WHERE id=?'; - my $status = $crms->SimpleSqlGet($sql, $id); - return 1 if !defined $status or $status == 0; - $sql = 'SELECT COUNT(*) FROM reviews r INNER JOIN queue q ON r.id=q.id'. - ' INNER JOIN cri c ON r.id=c.id'. - ' WHERE r.id=? AND r.user=? AND q.source="cri" AND c.exported=0'; - return $crms->SimpleSqlGet($sql, $id, $user); -} - -# Generates HTML to get the field type menu on the CRI Data page. -sub DataSearchMenu -{ - my $self = shift; - my $searchName = shift; - my $searchVal = shift; - - my $html = "\n"; - return $html; -} - -sub ConfirmCRI -{ - my $self = shift; - my $id = shift; - my $user = shift || $self->GetUser(); - my $cgi = shift; - - my $crms = $self->get('crms'); - my $und = $cgi->param('und'); - my $qstatus = $crms->AddItemToQueueOrSetItemActive($id, 0, 1, 'cri'); - my $err = join '; ', @{$crms->GetErrors()}; - if (!$err) - { - $err = $qstatus->{'msg'} if $qstatus->{'status'} eq '1'; - } - if (!$err) - { - my $gid = $crms->SimpleSqlGet('SELECT gid FROM cri WHERE id=?', $id); - my $note = Encode::decode("UTF-8", $cgi->param('note')); - my $start = $cgi->param('start'); - my $seluser = $cgi->param('seluser'); - my $sql = 'SELECT attr,reason,category,renNum,renDate FROM historicalreviews WHERE user=? AND gid=?'; - my $ref = $crms->SelectAll($sql, $seluser, $gid); - my $predictedRights = $cgi->param('predictedRights'); - my ($attr, $reason); - $attr = $ref->[0]->[0]; - $reason = $ref->[0]->[1]; - my $category = $ref->[0]->[2]; - $category = 'Expert Note' unless defined $category and length $category; - if ($predictedRights) - { - my ($a,$r) = split '/', $predictedRights; - $attr = $crms->TranslateAttr($a); - $reason = $crms->TranslateReason($r); - } - if ($und) - { - $attr = $crms->TranslateAttr('und'); - $reason = $crms->TranslateReason('nfi'); - } - my ($renNum, $renDate) = ($ref->[0]->[3], $ref->[0]->[4]); - $err = $crms->ValidateSubmission($id, $user, $attr, $reason, $note, $category, - $renNum, $renDate) unless $err; - my $stat = $crms->GetSystemStatus(); - my $status = $stat->[1]; - $err = "The CRMS is not currently accepting reviews (status '$status'). Please Cancel." if $stat->[1] ne 'normal'; - if (!$err) - { - $crms->SubmitReview($id, $user, $attr, $reason, $note, $renNum, $crms->IsUserExpert($user), - $renDate, $category, undef, undef, undef, $start); - my $ref = $crms->GetErrors(); - $err = $ref->[0] if $ref && $ref->[0]; - } - } - if (!$err) - { - my $status = ($und)? 2:1; - $crms->PrepareSubmitSql('UPDATE cri SET status=? WHERE id=?', $status, $id); - } - return $err; -} - -# Set status to 0 (rejected). -# In case of a revised review, removes queue entry and review if any. -sub RejectCRI -{ - my $self = shift; - my $id = shift; - my $user = shift || $self->GetUser(); - - my $crms = $self->get('crms'); - $crms->PrepareSubmitSql('UPDATE cri SET status=0 WHERE id=?', $id); - my $err = join '; ', @{$crms->GetErrors()}; - if (!defined $err || $err eq '') - { - my $sql = 'DELETE FROM reviews WHERE id=? AND user=?'; - $crms->PrepareSubmitSql($sql, $id, $user); - $sql = 'DELETE FROM queue WHERE id=? AND source="cri"'; - $crms->PrepareSubmitSql($sql, $id); - } - return $err; -} - -# To be called after data moves from reviews to historical, and from queue to exportdata. -# For each unexported cri with non-NULL status, update by marking as exported and adding -# the determination's gid (if any). -sub ProcessCRI -{ - my $self = shift; - - my $crms = $self->get('crms'); - my $sql = 'SELECT id,status FROM cri WHERE status IS NOT NULL AND exported=0'; - my $ref = $crms->SelectAll($sql); - foreach my $row (@{$ref}) - { - my $id = $row->[0]; - my $status = $row->[1]; - my $newgid; - if ($status == 1 || $status == 2) - { - $sql = 'SELECT gid FROM exportdata WHERE id=? AND src="cri" ORDER BY time DESC LIMIT 1'; - $newgid = $crms->SimpleSqlGet($sql, $id); - print "Processing status $status CRI $id with gid $newgid\n"; - } - elsif ($status == 0) - { - print "Checking status $status CRI $id for candidacy\n"; - $crms->CheckAndLoadItemIntoCandidates($id); - } - $sql = 'UPDATE cri SET exported=1,newgid=? WHERE id=?'; - $crms->PrepareSubmitSql($sql, $newgid, $id); - } -} - -sub LikeQuery -{ - my $self = shift; - my $str = shift; - - my ($best, $bestlen) = ('', 0); - my @words = split /\s/, $str; - foreach my $word (@words) - { - $word =~ s/[.,;:"\$\(\)\[\]]+//g; - if ($word =~ m/[A-Za-z0-9']/) - { - if (length $word > $bestlen) - { - $best = $word; - $bestlen = length $word; - } - } - } - my $q = $best. '%'; - #print "$best\n"; - $q = '%'. $q unless $str =~ m/^$best/; - return $q; -} - -# Returns the gid of the determination selected, or undef -sub CheckVolume -{ - my $self = shift; - my $id = shift; - - my $crms = $self->get('crms'); - returr if $crms->SimpleSqlGet('SELECT COUNT(*) FROM cri WHERE id=?', $id); - my $author = $crms->GetAuthor($id) || ''; - my $title = $crms->GetTitle($id) || ''; - return unless length $author and length $title; - my $sysid = $crms->BarcodeToId($id); - my $restr = ''; - $restr .= sprintf ' AND b.author LIKE "%s"', $self->LikeQuery($author); - $restr .= sprintf ' AND b.title LIKE "%s"', $self->LikeQuery($title); - $author =~ s/[^A-Za-z0-9]//g; - $title =~ s/[^A-Za-z0-9]//g; - my %seen; - my $sql = 'SELECT e.id,e.status,e.gid FROM exportdata e INNER JOIN bibdata b on e.id=b.id'. - ' WHERE b.id!=? AND b.sysid!=? AND e.src!="inherited"'. - ' AND (e.attr="pd" OR e.attr="pdus" OR e.attr="icus" OR e.attr="und")'. - $restr. ' ORDER BY e.time DESC'; - my ($best4, $best5, $best7); - my $ref2 = $crms->SelectAll($sql, $id, $sysid); - foreach my $row2 (@{$ref2}) - { - my $id2 = $row2->[0]; - next if $seen{$id2}; - my $status2 = $row2->[1]; - my $gid2 = $row2->[2]; - $seen{$id2} = 1; - my $author2 = $crms->GetAuthor($id2) || ''; - $author2 =~ s/[^A-Za-z0-9]//g; - my $title2 = $crms->GetTitle($id2) || ''; - $title2 =~ s/[^A-Za-z0-9]//g; - if ($author.$title eq $author2.$title2) - { - my $rights = $crms->GetCurrentRights($id); - my $rights2 = $crms->GetCurrentRights($id2); - if ($rights ne $rights2) - { - $best4 = $gid2 if $status2 == 4 and not defined $best4; - $best5 = $gid2 if $status2 == 5 and not defined $best5; - $best7 = $gid2 if $status2 == 7 and not defined $best7; - last if defined $best5; - } - } - } - if (defined $best4 or defined $best5 or defined $best7) - { - return (defined $best5)? $best5: - ((defined $best7)? $best7:$best4); - } - return; -} - -return 1; diff --git a/cgi/CRMS.pm b/cgi/CRMS.pm index 335be95f..2f0ff4ae 100755 --- a/cgi/CRMS.pm +++ b/cgi/CRMS.pm @@ -5255,13 +5255,13 @@ sub CreateSystemReport $n = 'n/a'; } $report .= 'Last Candidates Update' . $n . "\n"; - my $sql = 'SELECT COUNT(*) FROM und WHERE src!="no meta" AND src!="duplicate" AND src!="cross-record inheritance"'; + my $sql = 'SELECT COUNT(*) FROM und WHERE src!="no meta" AND src!="duplicate"'; $count = $self->SimpleSqlGet($sql); $report .= "Volumes Filtered*$count\n"; if ($count) { - $sql = 'SELECT src,COUNT(src) FROM und WHERE src!="no meta"'. - ' AND src!="duplicate" AND src!="cross-record inheritance" GROUP BY src ORDER BY src'; + $sql = 'SELECT src,COUNT(src) FROM und WHERE src!="no meta" AND src!="duplicate"'. + ' GROUP BY src ORDER BY src'; my $ref = $self->SelectAll($sql); foreach my $row (@{ $ref}) { @@ -5270,13 +5270,13 @@ sub CreateSystemReport $report .= sprintf("    $src$n (%0.1f%%)\n", 100.0*$n/$count); } } - $sql = 'SELECT COUNT(*) FROM und WHERE src="no meta" OR src="duplicate" OR src="cross-record inheritance"'; + $sql = 'SELECT COUNT(*) FROM und WHERE src="no meta" OR src="duplicate"'; $count = $self->SimpleSqlGet($sql); $report .= "Volumes Temporarily Filtered*$count\n"; if ($count) { $sql = 'SELECT src,COUNT(src) FROM und WHERE src="no meta" OR src="duplicate"'. - ' OR src="cross-record inheritance" GROUP BY src ORDER BY src'; + ' GROUP BY src ORDER BY src'; my $ref = $self->SelectAll($sql); foreach my $row (@{ $ref}) { @@ -6286,14 +6286,6 @@ sub GetTrackingInfo my $projinfo = (defined $proj)? ", $proj project":''; push @stati, "in Queue (P$pri, status $status, $n $reviews$projinfo)"; } - elsif ($self->SimpleSqlGet('SELECT COUNT(*) FROM cri WHERE id=? AND exported=0', $id)) - { - my $stat = $self->SimpleSqlGet('SELECT status FROM cri WHERE id=?', $id); - my %stats = (0 => 'rejected', 1 => 'submitted', 2 => 'UND'); - my $msg = 'unreviewed'; - $msg = $stats{$stat} if defined $stat; - push @stati, "CRI-eligible ($msg)"; - } elsif ($self->SimpleSqlGet('SELECT COUNT(*) FROM candidates WHERE id=?', $id)) { my $sql = 'SELECT p.name FROM candidates c'. @@ -6304,7 +6296,7 @@ sub GetTrackingInfo my $src = $self->SimpleSqlGet('SELECT src FROM und WHERE id=?', $id); if (defined $src) { - my %temps = ('no meta' => 1, 'duplicate' => 1, 'cross-record inheritance' => 1); + my %temps = ('no meta' => 1, 'duplicate' => 1); push @stati, sprintf "%sfiltered ($src)", (defined $temps{$src})? 'temporarily ':''; } if ($self->SimpleSqlGet('SELECT COUNT(*) FROM exportdata WHERE id=?', $id)) diff --git a/cgi/criData.tt b/cgi/criData.tt deleted file mode 100755 index cc1b8ec2..00000000 --- a/cgi/criData.tt +++ /dev/null @@ -1,390 +0,0 @@ -[% INCLUDE header.tt %] - -[% xicon = crms.WebPath('web', 'XIcon.png') %] -[% checkicon = crms.WebPath('web', 'CheckIcon.png') %] -[% minusicon = crms.WebPath('web', 'MinusIcon.png') %] - - - - -
- -
- -

Cross-Record Inheritance:

-[% page = cgi.param("p") %] -[% op1 = cgi.param("op1") %] -[% search1 = cgi.param("search1") %] -[% search2 = cgi.param("search2") %] -[% search1value = cgi.param("search1value") %] -[% search2value = cgi.param("search2value") %] -[% order = cgi.param('order') %] -[% dir = cgi.param('dir') %] -[% recs = cgi.param('records') %] - -[% recs = recs.replace('\D','') %] -[% IF NOT recs %] - [% recs = cgi.cookie('recs') or 20 %] - [% CALL cgi.param('records', recs) %] -[% END %] - -[% IF NOT dir %] - [% dir = 'ASC' %] - [% CALL cgi.param('dir', 'ASC') %] -[% END %] - -[% IF NOT search1 %] - [% search1 = 'id' %] - [% CALL cgi.param('search1', 'id') %] -[% END %] -[% IF NOT search2 %] - [% search2 = 'id' %] - [% CALL cgi.param('search2', 'id') %] -[% END %] -[% IF NOT order %] - [% order = 'author' %] - [% CALL cgi.param('order', 'author') %] -[% END %] -
-
- -
- -[% crms.HiddenSys() %] - -Restrict selection:
- -[% cri.DataSearchMenu('search1', search1) %] - - -
- -[% cri.DataSearchMenu('search2', search2) %] - -
- - -[% cri.DataSearchMenu('order', order) %] -
- - - - -
- - - -records per page. -
- - -
-
-
-[% search1 = cgi.param('search1') %] -[% search1value = cgi.param('search1value') %] -[% search2 = cgi.param('search2') %] -[% search2value = cgi.param('search2value') %] -[% op1 = cgi.param('op1') %] -[% order = cgi.param('order') %] -[% dir = cgi.param('dir') %] -[% offset = cgi.param('offset') %] -[% p = cgi.param('p') %] -[% pagesize = cgi.param('records') %] -[% jump = cgi.param('jump') %] -[% pagesize = pagesize.replace('\D','') %] -[% IF NOT pagesize %][% pagesize = 20 %][% END %] - -[% IF jump %] -[% offset = (jump - 1) * pagesize %] -[% END %] - -[% CALL cgi.param('records',pagesize) %] -[% CALL cgi.param('offset',offset) %] - -[% ref = cri.DataRef(order, dir, search1, search1value, op1, search2, - search2value, offset, pagesize) %] - -[% total = ref.volumes %] - -[% IF total > 0 %] - [% pagenum = ref.page %] - [% of = ref.of %] - [% items = ref.rows %] - -

Found $total, page $pagenum of $of

- - [% IF NOT offset %] [% offset = 0 %] [% END %] - [% IF offset > 0 %] [% next = offset + pagesize %] - [% ELSE %] [% next = pagesize %] [% END %] - [% IF offset > 0 %] [% prev = offset - pagesize %] - [% ELSE %] [% prev = 0 %] [% END %] - - [% IF total > pagesize %] [% last = (of - 1) * pagesize %] - [% ELSE %] [% last = 0 %] [% END %] - - [% doPrev = (offset > 0) %] - [% doNext = (offset < last) %] - [% doFirst = (offset != 0) %] - [% doLast = (offset != last) %] - [% IF doPrev %] - previous [% pagesize %] - [% ELSE %] - previous [% pagesize %] - [% END %] -  ||  - [% IF doNext %] - next [% pagesize %] - [% ELSE %] - next [% pagesize %] - [% END %] -  ||  - [% IF doFirst %] - first page - [% ELSE %] - first page - [% END %] -  ||  - [% IF doLast %] - last page - [% ELSE %] - last page - [% END %] - - [% color_white = '#FFFFFF' %] - [% color_gray = '#EECCEE' %] - [% prev_id = '' %] - [% active_color = color_white %] - [% fields = cri.Fields() %] - - - [% titles = cri.Titles() %] - [% FOREACH title IN titles %][% END %] - - [% FOREACH item IN ref.rows %] - - [% IF prev_id == '' %][% prev_id = item.author %][% END %] - - [% IF prev_id != item.author %] - [% IF active_color == color_gray %] - [% active_color = color_white %] - [% ELSIF active_color == color_white %] - [% active_color = color_gray %] - [% END %] - [% END %] - - [% col = active_color %] - [% IF item.status == 0 || item.status == 1 || item.status == 2 %] - [% col = '#e2e2e2' %] - [% END %] - - [% FOREACH field IN fields %] - [% fid = field _ item.id %] - - [% END %] - - - [% prev_id = item.author %] - - [% END %] -
[% title %]
- [% IF field=='status' %] - [% IF item.status == 1 %] - Accepted - [% ELSIF item.status == 0 %] - Rejected - [% ELSIF item.status == 2 %] - UND - [% END %] - [% ELSIF field=='id' && cri.CanEditCri(item.$field) %] - [% cri.LinkToReview(item.$field, item.$field) %] - [% ELSE %] - [% item.$field %] - [%END %] -
- - [% IF doPrev %] - - [% ELSE %] - - [% END %] - previous [% pagesize %] - [% IF doPrev %][% ELSE %][% END %] -  ||  - [% IF doNext %] - - [% ELSE %] - - [% END %] - next [% pagesize %] - [% IF doNext %][% ELSE %][% END %] - - [% IF of > 1 %] -
-

Found $total, page $pagenum of $of

- -
- Jump to Page: - [% crms.Hiddenify(cgi) %] - -     || - [% min = pagenum - 10 %] - [% IF min < 1 %][% min = 1 %][% END %] - [% max = pagenum + 10 %] - [% IF max > of %][% max = of %][% END %] - [% FOREACH pg IN [min .. max] %] - [% IF pg == pagenum %] - [% pg %] || - [% ELSE %] - [% off = (pg - 1) * pagesize %] - [% pg %] || - [% END %] - [% END %] -
- [% END %] -[% ELSE %] -

No results found.

-[% END %] - - -[% INCLUDE footer.tt %] diff --git a/cgi/getCRIInfo b/cgi/getCRIInfo deleted file mode 100755 index f9d615b1..00000000 --- a/cgi/getCRIInfo +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/perl - -use strict; - -BEGIN { - die "SDRROOT environment variable not set" unless defined $ENV{'SDRROOT'}; - use lib $ENV{'SDRROOT'} . '/crms/cgi'; -} - -use CGI; -use JSON::XS; - -use CRMS; -use CRI; - -my $cgi = new CGI; -my $sys = $cgi->param('sys') || 'crms'; -my $crms = CRMS->new(cgi => $cgi, - sys => $sys); -my $cri = CRI->new(crms => $crms); -my $id = $cgi->param('id'); -my $data = $cri->GetCRIInfo($id) || ''; -my $json = JSON::XS->new->encode($data); -print $cgi->header(-type => 'application/json', -charset => 'utf-8'); -print $json; diff --git a/cgi/submitCRIForm.tt b/cgi/submitCRIForm.tt deleted file mode 100644 index 642fce31..00000000 --- a/cgi/submitCRIForm.tt +++ /dev/null @@ -1,248 +0,0 @@ - - -
- - - - - - [% IF user %][% END %] - [% IF editing %][% END %] - [% IF sys %][% END %] - - - - - - - - - - - - - - - - [% IF dateRange %] - - - - - [% END %] - - - - - - - . - - - - - - - - -
- Rights: - - - -
-
- Category: -
- ADD: -
- - -
- -
- - - -
- -
-[% reviews = cri.GetReviewsRef(gid) %] - - - [% FOREACH review IN reviews %] - - - - - [% END %] -
Import user review:
- [% review.attr %]/[% review.reason %]
- [% review.user %] - - - - -
- -
- -[% IF error %] - - - - - - - -
- Warning: -
- -
-[% END %] - -
diff --git a/docker/db/sql/001_crms_schema.sql b/docker/db/sql/001_crms_schema.sql index e3628e2f..66a8cbe6 100644 --- a/docker/db/sql/001_crms_schema.sql +++ b/docker/db/sql/001_crms_schema.sql @@ -262,24 +262,6 @@ CREATE TABLE `corrections` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Table structure for table `cri` --- - -DROP TABLE IF EXISTS `cri`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `cri` ( - `id` varchar(32) NOT NULL, - `gid` bigint(20) NOT NULL, - `locked` varchar(64) DEFAULT NULL, - `status` tinyint(4) DEFAULT NULL, - `exported` tinyint(4) NOT NULL DEFAULT '0', - `newgid` bigint(20) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - -- -- Table structure for table `dbo_T_BOOK` --