return (grep {$_->shortname eq $sn} @$list)[0];
};
+
+
+
+
+ # Turns one string into two for long text strings
+ $locale_subs->{split_for_accordion} = sub {
+ my $string = shift;
+ my $trunc_length = shift;
+
+ return unless defined $string && defined $trunc_length;
+ return if $trunc_length > length $string;
+
+ my $short;
+ my $rest;
+ # find non-whitespace from end
+ # 0-BASED!
+
+ if ((substr $string, $trunc_length, 1) =~ /\s/) {
+ # Next character is whitespace - we're good; split there
+
+ $short = substr $string, 0, $trunc_length;
+ $rest = substr $string, $trunc_length;
+ }
+ else {
+ # find the space nearest the end of our (not-yet) truncated string
+ my $loc = rindex $string, ' ', $trunc_length;
+
+ # FIXME: if $loc = -1 (can't truncate - no spaces found)
+ $short = substr $string, 0, $loc;
+ $rest = substr $string, $loc;
+ }
+
+ return ($short, $rest);
+ };
+
+
+
+
+
+
+
+
$locale_subs->{aouct_tree} = sub {
# fetch the org unit tree
}
}
- $cache{aouct_tree}{$locale} =
+ $cache{aouct_tree}{$locale} =
$node_tree->org_unit if $node_tree;
}
undef $e;
$self->apache->print(
$self->cgi->redirect(
- -url => $url ||
- $self->cgi->param('redirect_to') ||
- $self->ctx->{referer} ||
+ -url => $url ||
+ $self->cgi->param('redirect_to') ||
+ $self->ctx->{referer} ||
$self->ctx->{home_page},
-cookie => $cookie
)
if ($ctx->{user}) {
# See if the user has a search library preference
my $lset = $self->editor->search_actor_user_setting({
- usr => $ctx->{user}->id,
+ usr => $ctx->{user}->id,
name => 'opac.default_search_location'
})->[0];
return OpenSRF::Utils::JSON->JSON2perl($lset->value) if $lset;
}
}
-# Extracts the copy location org unit and group from the
+# Extracts the copy location org unit and group from the
# "logc" param, which takes the form org_id:grp_id.
sub extract_copy_location_group_info {
my $self = shift;
my $self = shift;
my $ctx = $self->ctx;
- # User can access to the search location groups at the current
+ # User can access to the search location groups at the current
# search lib, the physical location lib, and the patron's home ou.
my @ctx_orgs = $ctx->{search_ou};
push(@ctx_orgs, $ctx->{physical_loc}) if $ctx->{physical_loc};
owner => {
in => {
select => {aou => [{
- column => 'id',
+ column => 'id',
transform => 'actor.org_unit_full_path',
result_field => 'id',
}]},
if (! ($grps = $cache{search_filter_groups}{$org_id}) ) {
$grps = $self->editor->search_actor_search_filter_group([
{owner => $org_id},
- { flesh => 2,
+ { flesh => 2,
flesh_fields => {
asfg => ['entries'],
asfge => ['query']
$cache{search_filter_groups}{$org_id} = $grps;
}
- # for the current context, if a descendant org has a group
+ # for the current context, if a descendant org has a group
# with a matching code replace the group from the parent.
$seen{$_->code} = $_ for @$grps;
}
if ($depth) {
# find the top-most ctx-org ancestor at the provided depth
- while ($depth < $ctx_ou->ou_type->depth
+ while ($depth < $ctx_ou->ou_type->depth
and $ctx_ou->id != $test_ou->id) {
$ctx_ou = $ctx->{get_aou}->($ctx_ou->parent_ou);
}
return 0;
};
- # Returns true if the provided org unit is within the same
+ # Returns true if the provided org unit is within the same
# org unit hiding depth-scoped tree as the physical location.
# Org unit hiding is based on the immutable physical_loc
# and is not meant to change as search/pref/etc libs change
return 1 unless $depth; # 0 or undef
- return $ctx->{org_within_scope}->(
- $ctx->{get_aou}->($ploc),
+ return $ctx->{org_within_scope}->(
+ $ctx->{get_aou}->($ploc),
$ctx->{get_aou}->($org_id), $depth);
-
+
};
- # Evaluates to true if the context org (defaults to get_library)
- # is not within the hiding scope. Also evaluates to true if the
+ # Evaluates to true if the context org (defaults to get_library)
+ # is not within the hiding scope. Also evaluates to true if the
# user's pref_ou is set and it's out of hiding scope.
# Always evaluates to true when ctx.is_staff
$ctx->{org_hiding_disabled} = sub {
return 1 if !$ctx->{org_within_hiding_scope}->($ctx_org);
- return 1 if $ctx->{pref_ou} and $ctx->{pref_ou} != $ctx_org
+ return 1 if $ctx->{pref_ou} and $ctx->{pref_ou} != $ctx_org
and !$ctx->{org_within_hiding_scope}->($ctx->{pref_ou});
return 0;
}
-# returns the list of org unit IDs for which the
+# returns the list of org unit IDs for which the
# selected org unit setting returned a true value
sub setting_is_true_for_orgs {
my ($self, $setting) = @_;
}
# Builds and links a perm checking function, testing permissions against
-# the currently logged in user.
+# the currently logged in user.
# ctx->{has_perm}->(perm_code, org_id) => 1/undef
# For security, perm checks are cached per page, not per process.
sub load_perm_funcs {
return 0 unless $self->editor->requestor;
if ($perm_cache{$org_id}) {
- return $perm_cache{$org_id}{$perm_code}
+ return $perm_cache{$org_id}{$perm_code}
if exists $perm_cache{$org_id}{$perm_code};
} else {
$perm_cache{$org_id} = {};
$self->editor->allowed($perm_code, $org_id);
}
}
-
+
1;
}
[id^="toggled-inline-"]:target{
display: inline;
+ul {
+ list-style: none;
+ perspective: 900;
+ padding: 0;
+ margin: 0;
+}
+ul li {
+ position: relative;
+ padding: 0;
+ margin: 0;
+ padding-bottom: 4px;
+ padding-top: 18px;
+ border-top: 1px dotted #dce7eb;
+}
+ul li:nth-of-type(1) {
+ animation-delay: 0.5s;
+}
+ul li:nth-of-type(2) {
+ animation-delay: 0.75s;
+}
+ul li:nth-of-type(3) {
+ animation-delay: 1s;
+}
+ul li:last-of-type {
+ padding-bottom: 0;
+}
+ul li i {
+ position: absolute;
+ transform: translate(-6px, 0);
+ margin-top: 16px;
+ right: 0;
+}
+ul li i:before, ul li i:after {
+ content: "";
+ position: absolute;
+ background-color: #ff6873;
+ width: 3px;
+ height: 9px;
+}
+ul li i:before {
+ transform: translate(-2px, 0) rotate(45deg);
+}
+ul li i:after {
+ transform: translate(2px, 0) rotate(-45deg);
+}
+ul li input[type=checkbox] {
+ position: absolute;
+ cursor: pointer;
+ width: 10%;
+ height: 100%;
+ z-index: 1;
+ opacity: 0;
+}
+ul li input[type=checkbox]:checked ~ p {
+ margin-top: 0;
+ max-height: 0;
+ opacity: 0;
+ transform: translate(0, 50%);
+}
+ul li input[type=checkbox]:checked ~ i:before {
+ transform: translate(2px, 0) rotate(45deg);
+}
+ul li input[type=checkbox]:checked ~ i:after {
+ transform: translate(-2px, 0) rotate(-45deg);
+}
+
+@keyframes flipdown {
+ 0% {
+ opacity: 0;
+ transform-origin: top center;
+ transform: rotateX(-90deg);
+ }
+ 5% {
+ opacity: 1;
+ }
+ 80% {
+ transform: rotateX(8deg);
+ }
+ 83% {
+ transform: rotateX(6deg);
+ }
+ 92% {
+ transform: rotateX(-3deg);
+ }
+ 100% {
+ transform-origin: top center;
+ transform: rotateX(0deg);
+ }
}
contents = [
{
label => l('General Note: '),
+trunc_length => 20,
xpath => '//*[@tag="500"]'
}, {
label => l('With Note: '),
xpath => '//*[@tag="502"]'
}, {
label => l('Bibliography, etc. Note: '),
+trunc_length => 25,
xpath => '//*[@tag="504"]'
}, {
label => l('Formatted Contents Note: '),
}, {
label => l('Source of Description Note: '),
xpath => '//*[@tag="588"]'
- }
+ }
];
BLOCK render_contents;
END;
total_contents = all_content.join(" ").replace('\s+$', '');
%] [% total_contents;
- IF total_contents.size; "<br/>"; END;
+ IF total_contents.size;
+ IF total_contents.length > cont.trunc_length; # should be ok on undefined... I think. Just skips it.
+ # need to chop!
+ blah = ctx.split_for_accordion(total_contents, cont.trunc_length);
+ cont.short = blah.0;
+ cont.long = blah.1;
+ END;
+ '<br/>';
+ END;
FOREACH link880 IN graphics;
'<div class="graphic880"' _ link880.dir _ '>';
link880.value | html;
'</div>';
END;
END;
-END
+END
%]
[% BLOCK render_all_contents;
FOREACH cont IN contents;
-%]
<tr>
<td class='rdetail_content_type'>[% cont.label %]</td>
- <td class='rdetail_content_value' property='keywords'>[% content %]</td>
+ <td class='rdetail_content_value' property='keywords'>
+[% IF cont.short.length %]
+<ul>
+<li>
+ [% cont.short %]... <input type="checkbox" checked>[% l('(click for more)') %] <p>[% cont.long%]</p>
+</li>
+</ul>
+[% ELSE %]
+ [% content %]
+[% END; %]
+</td>
</tr>
[%- END; %]
[%- END; %]
[%- content_html %]
</tbody>
</table>
-[%- END %]
+[%- END %]
\ No newline at end of file