Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…iscovery into 24.09.00
  • Loading branch information
mdnoble73 committed Sep 2, 2024
2 parents 3d37c9f + 7555f3e commit 5658283
Show file tree
Hide file tree
Showing 12 changed files with 122 additions and 43 deletions.
6 changes: 3 additions & 3 deletions code/aspen_app/app-configs/version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "24.08.00",
"build": "270",
"patch": "0"
"version": "24.09.00",
"build": "275",
"patch": "2"
}
21 changes: 14 additions & 7 deletions code/aspen_app/src/screens/MyAccount/TitlesOnHold/MyHold.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { MaterialCommunityIcons, MaterialIcons } from '@expo/vector-icons';
import { useNavigation } from '@react-navigation/native';
import CachedImage from 'expo-cached-image';
import DateTimePickerModal from 'react-native-modal-datetime-picker';
import { Image } from 'expo-image';
import _ from 'lodash';
import { Actionsheet, Box, Button, Center, Checkbox, HStack, Icon, Pressable, Text, useDisclose, VStack } from 'native-base';
import { Actionsheet, Box, Button, Center, Checkbox, HStack, Icon, Pressable, Text, useDisclose, VStack, useToken, useColorModeValue } from 'native-base';
import React from 'react';
import { popAlert } from '../../../components/loadError';
import { HoldsContext, LanguageContext, LibrarySystemContext, UserContext } from '../../../context/initialContext';
import { getAuthor, getBadge, getCleanTitle, getExpirationDate, getFormat, getOnHoldFor, getPickupLocation, getPosition, getStatus, getTitle, getType } from '../../../helpers/item';
import { navigateStack } from '../../../helpers/RootNavigator';
import { getTermFromDictionary, getTranslationsWithValues } from '../../../translations/TranslationService';
import { cancelHold, cancelHolds, cancelVdxRequest, thawHold, thawHolds } from '../../../util/accountActions';
import { getTermFromDictionary } from '../../../translations/TranslationService';
import { cancelHold, cancelHolds, cancelVdxRequest, freezeHold, freezeHolds, thawHold, thawHolds } from '../../../util/accountActions';
import { formatDiscoveryVersion } from '../../../util/loadLibrary';
import { checkoutItem } from '../../../util/recordActions';
import { SelectPickupLocation } from './SelectPickupLocation';
Expand Down Expand Up @@ -89,6 +89,9 @@ export const MyHold = (props) => {
}
}

const freezingHoldLabel = getTermFromDictionary(language, 'freezing_hold');
const freezeHoldLabel = getTermFromDictionary(language, 'freeze_hold');

const openGroupedWork = (item, title) => {
navigateStack('AccountScreenTab', 'MyHold', {
id: item,
Expand Down Expand Up @@ -251,7 +254,7 @@ export const MyHold = (props) => {
</Actionsheet.Item>
);
} else {
return <SelectThawDate isOpen={isOpen} label={null} language={language} libraryContext={library} holdsContext={updateHolds} onClose={onClose} freezeId={hold.cancelId} recordId={hold.recordId} source={hold.source} libraryUrl={library.baseUrl} userId={hold.userId} resetGroup={resetGroup} />;
return <SelectThawDate isOpen={isOpen} label={null} freezeLabel={freezeHoldLabel} freezingLabel={freezingHoldLabel} language={language} libraryContext={library} holdsContext={updateHolds} onClose={onClose} freezeId={hold.cancelId} recordId={hold.recordId} source={hold.source} libraryUrl={library.baseUrl} userId={hold.userId} resetGroup={resetGroup} />;
}
} else {
return null;
Expand Down Expand Up @@ -371,6 +374,8 @@ export const ManageSelectedHolds = (props) => {
const numToFreezeLabel = getTermFromDictionary(language, 'freeze_selected_holds') + ' (' + numToFreeze + ')';
const numToThawLabel = getTermFromDictionary(language, 'thaw_selected_holds') + ' (' + numToThaw + ')';
const numSelectedLabel = getTermFromDictionary(language, 'manage_selected') + ' (' + numSelected + ')';
const freezingHoldLabel = getTermFromDictionary(language, 'freezing_hold');
const freezeHoldLabel = getTermFromDictionary(language, 'freeze_hold');

const cancelActionItem = () => {
if (numToCancel > 0) {
Expand Down Expand Up @@ -424,7 +429,7 @@ export const ManageSelectedHolds = (props) => {
<Actionsheet isOpen={isOpen} onClose={onClose}>
<Actionsheet.Content>
{cancelActionItem()}
<SelectThawDate isOpen={isOpen} label={numToFreezeLabel} language={language} holdsContext={updateHolds} libraryContext={library} resetGroup={resetGroup} onClose={onClose} count={numToFreeze} numSelected={numSelected} data={titlesToFreeze} />
<SelectThawDate isOpen={isOpen} label={numToFreezeLabel} freezeLabel={freezeHoldLabel} freezingLabel={freezingHoldLabel} language={language} holdsContext={updateHolds} libraryContext={library} resetGroup={resetGroup} onClose={onClose} count={numToFreeze} numSelected={numSelected} data={titlesToFreeze} />
{thawActionItem()}
</Actionsheet.Content>
</Actionsheet>
Expand Down Expand Up @@ -489,6 +494,8 @@ export const ManageAllHolds = (props) => {
const numToCancelLabel = getTermFromDictionary(language, 'cancel_all_holds') + ' (' + numToCancel + ')';
const numToFreezeLabel = getTermFromDictionary(language, 'freeze_all_holds') + ' (' + numToFreeze + ')';
const numToThawLabel = getTermFromDictionary(language, 'thaw_all_holds') + ' (' + numToThaw + ')';
const freezingHoldLabel = getTermFromDictionary(language, 'freezing_hold');
const freezeHoldLabel = getTermFromDictionary(language, 'freeze_hold');

if (numToManage >= 1) {
return (
Expand All @@ -511,7 +518,7 @@ export const ManageAllHolds = (props) => {
}}>
{numToCancelLabel}
</Actionsheet.Item>
<SelectThawDate label={numToFreezeLabel} language={language} holdsContext={updateHolds} libraryContext={library} resetGroup={resetGroup} onClose={onClose} count={numToFreeze} numSelected={numToManage} data={titlesToFreeze} />
<SelectThawDate label={numToFreezeLabel} freezeLabel={freezeHoldLabel} freezingLabel={freezingHoldLabel} language={language} holdsContext={updateHolds} libraryContext={library} resetGroup={resetGroup} onClose={onClose} count={numToFreeze} numSelected={numToManage} data={titlesToFreeze} />
<Actionsheet.Item
isLoading={thawing}
isLoadingText={getTermFromDictionary(language, 'thaw_hold', true)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@ import React from 'react';
import DateTimePickerModal from 'react-native-modal-datetime-picker';
import { MaterialIcons } from '@expo/vector-icons';
import { Actionsheet, Icon, useToken, useColorModeValue } from 'native-base';
import { LanguageContext } from '../../../context/initialContext';
import { freezeHold, freezeHolds } from '../../../util/accountActions';
import { getTermFromDictionary } from '../../../translations/TranslationService';

export const SelectThawDate = (props) => {
const { label, language, libraryContext, onClose, freezeId, recordId, source, userId, resetGroup, isOpen } = props;
const { freezingLabel, freezeLabel, label, libraryContext, onClose, freezeId, recordId, source, userId, resetGroup, isOpen } = props;
let data = props.data;
const { language } = React.useContext(LanguageContext);
const [loading, setLoading] = React.useState(false);

const textColor = useToken('colors', useColorModeValue('text.500', 'text.50'));
const colorMode = useColorModeValue(false, true);

let actionLabel = getTermFromDictionary(language, 'freeze_hold');
let actionLabel = freezeLabel;
if (label) {
actionLabel = label;
}
Expand Down Expand Up @@ -57,7 +59,7 @@ export const SelectThawDate = (props) => {
<Actionsheet.Item startIcon={data ? null : <Icon as={MaterialIcons} name="pause" color="trueGray.400" mr="1" size="6" />} onPress={showDatePicker}>
{actionLabel}
</Actionsheet.Item>
<DateTimePickerModal isVisible={isDatePickerVisible} date={date} mode="date" onConfirm={onSelectDate} onCancel={hideDatePicker} isDarkModeEnabled={colorMode} minimumDate={today} textColor={textColor} confirmTextIOS={loading ? getTermFromDictionary('en', 'freezing_hold') : getTermFromDictionary('en', 'freeze_hold')} />
<DateTimePickerModal isVisible={isDatePickerVisible} date={date} mode="date" onConfirm={onSelectDate} onCancel={hideDatePicker} isDarkModeEnabled={colorMode} minimumDate={today} textColor={textColor} confirmTextIOS={loading ? freezingLabel : actionLabel} />
</>
);
};
11 changes: 10 additions & 1 deletion code/aspen_app/src/screens/Search/Facets/RadioGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ export default class Facet_RadioGroup extends Component {

componentDidUpdate(prevProps, prevState) {
if (prevState.value !== this.state.applied) {
this.renderValue();
console.log('prevState.value', prevState.value);
console.log('this.state.applied', this.state.applied);
//this.renderValue();
}
}

Expand All @@ -59,17 +61,22 @@ export default class Facet_RadioGroup extends Component {
const { category, value } = this.state;
if (category !== 'sort_by') {
console.log('payload > ', payload);
console.log('value > ', value);
if (payload === value) {
console.log('new is same as old. removing.');
removeAppliedFilter(category, payload);
this.setState({
value: '',
});
} else {
console.log('new value. adding.');
addAppliedFilter(category, payload, false);
this.setState({
value: payload,
});
}

console.log('current state value: ' + this.state.value);
} else {
console.log('payload > ', payload);
console.log('value > ', value);
Expand All @@ -94,6 +101,8 @@ export default class Facet_RadioGroup extends Component {
const { items, category, title, updater, applied } = this.state;
const name = category + '_group';

console.log(items);

if (category === 'sort_by') {
return (
<VStack space={2}>
Expand Down
53 changes: 53 additions & 0 deletions code/web/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@
if (strlen($userAgentString) > 512) {
$userAgentString = substr($userAgentString, 0, 512);
}
if (isSpammyUserAgent($userAgentString)) {
http_response_code(404);
echo("<html><head><title>Page Not Found</title></head><body><h1>404</h1> <p>We're sorry, but the page you are looking for can't be found.</p></body></html>");
die();
}
$userAgent->userAgent = $userAgentString;
if ($userAgent->find(true)) {
$userAgentId = $userAgent->id;
Expand Down Expand Up @@ -431,4 +436,52 @@ function getGitBranch() {
}

return $branchName;
}

//Look for spammy user agents and kill them
function isSpammyUserAgent($userAgentString): bool {
if (stripos($userAgentString, 'DBMS_PIPE.RECEIVE_MESSAGE') !== false) {
return true;
} elseif (stripos($userAgentString, 'PG_SLEEP') !== false) {
return true;
} elseif (stripos($userAgentString, 'SELECT') !== false) {
return true;
} elseif (stripos($userAgentString, 'SLEEP') !== false) {
return true;
} elseif (stripos($userAgentString, 'ORDER BY') !== false) {
return true;
} elseif (stripos($userAgentString, 'WAITFOR') !== false) {
return true;
} elseif (stripos($userAgentString, 'nvOpzp') !== false) {
return true;
} elseif (stripos($userAgentString, 'window.location') !== false) {
return true;
} elseif (stripos($userAgentString, 'window.top') !== false) {
return true;
} elseif (stripos($userAgentString, 'nslookup') !== false) {
return true;
} elseif (stripos($userAgentString, 'if(') !== false) {
return true;
} elseif (stripos($userAgentString, 'now(') !== false) {
return true;
} elseif (stripos($userAgentString, 'sysdate()') !== false) {
return true;
} elseif (stripos($userAgentString, 'sleep(') !== false) {
return true;
} elseif (stripos($userAgentString, 'cast(') !== false) {
return true;
} elseif (stripos($userAgentString, 'current_database') !== false) {
return true;
} elseif (stripos($userAgentString, 'response.write') !== false) {
return true;
} elseif (stripos($userAgentString, 'CONVERT(') !== false) {
return true;
} elseif (stripos($userAgentString, 'EXTRACTVALUE(') !== false) {
return true;
}
$termWithoutTags = strip_tags($userAgentString);
if ($termWithoutTags != $userAgentString) {
return true;
}
return false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,28 @@
<div class="col-xs-12">{$alternateLibraryCardFormMessage}</div>
</div>
{/if}
<div class="form-group row">
<label for="alternateLibraryCard" class="control-label col-xs-12 col-sm-4">
<div class="form-group propertyRow">
<label for="alternateLibraryCard" class="control-label">
{if !empty($alternateLibraryCardLabel)}
{translate text=$alternateLibraryCardLabel isPublicFacing=true isAdminEnteredData=true}
{else}
{translate text="Alternate Library Card" isPublicFacing=true isAdminEnteredData=false}
{/if}
</label>
<div class="col-md-6">
<div>
<input type="text" name="alternateLibraryCard" id="alternateLibraryCard" value="{$user->alternateLibraryCard}" maxlength="60" class="form-control" >
</div>
</div>
{if !empty($showAlternateLibraryCardPassword)}
<div class="form-group row">
<label for="alternateLibraryCardPassword" class="control-label col-xs-12 col-sm-4">
<div class="form-group propertyRow">
<label for="alternateLibraryCardPassword" class="control-label">
{if !empty($alternateLibraryCardPasswordLabel)}
{translate text=$alternateLibraryCardPasswordLabel isPublicFacing=true isAdminEnteredData=true}
{else}
{translate text="Password/PIN" isPublicFacing=true isAdminEnteredData=false}
{/if}
</label>
<div class="col-md-6">
<div>
<input type="password" name="alternateLibraryCardPassword" id="alternateLibraryCardPassword" value="{$user->alternateLibraryCardPassword}" maxlength="60" class="form-control">
</div>
</div>
Expand Down
16 changes: 8 additions & 8 deletions code/web/interface/themes/responsive/MyAccount/libraryCard.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<h1>{translate text=$alternateLibraryCardLabel isPublicFacing=true isAdminEnteredData=true}</h1>
{if !empty($alternateLibraryCardFormMessage)}
<div class="row">
<div class="col-xs-12">{$alternateLibraryCardFormMessage}<div>
<div class="col-xs-12">{$alternateLibraryCardFormMessage}</div>
</div>
{/if}
{if $alternateLibraryCardStyle != 'none'}
Expand All @@ -58,29 +58,29 @@
</div>
</div>
{/if}
<form name="alternateLibraryCard" method="post" class="form-horizontal">
<div class="form-group">
<label for="alternateLibraryCard" class="control-label col-xs-12 col-sm-4">
<form name="alternateLibraryCard" method="post" class="form col-xs-12">
<div class="form-group propertyRow">
<label for="alternateLibraryCard" class="control-label propertyRow">
{if !empty($alternateLibraryCardLabel)}
{translate text=$alternateLibraryCardLabel isPublicFacing=true isAdminEnteredData=true}
{else}
{translate text="Alternate Library Card" isPublicFacing=true isAdminEnteredData=false}
{/if}
</label>
<div class="col-md-6 col-md-offset-3">
<div>
<input type="text" name="alternateLibraryCard" id="alternateLibraryCard" value="{$profile->alternateLibraryCard}" maxlength="60" class="form-control" onchange="updateAlternateLibraryCardBarcode()">
</div>
</div>
{if !empty($showAlternateLibraryCardPassword)}
<div class="form-group">
<label for="alternateLibraryCardPassword" class="control-label col-xs-12 col-sm-4">
<div class="form-group propertyRow">
<label for="alternateLibraryCardPassword" class="control-label">
{if !empty($alternateLibraryCardPasswordLabel)}
{translate text=$alternateLibraryCardPasswordLabel isPublicFacing=true isAdminEnteredData=true}
{else}
{translate text="Password/PIN" isPublicFacing=true isAdminEnteredData=false}
{/if}
</label>
<div class="col-md-6 col-md-offset-3">
<div>
<input type="password" name="alternateLibraryCardPassword" id="alternateLibraryCardPassword" value="{$profile->alternateLibraryCardPassword}" maxlength="60" class="form-control">
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions code/web/interface/themes/responsive/js/aspen.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ AspenDiscovery.CloudLibrary = (function () {
var patronId = $("#patronId option:selected").val();
var useAlternateCard = $("#useAlternateLibraryCard").val();
var validCard = $("#patronId option:selected").attr("data-valid-card");
if (useAlternateCard === 0 || validCard === "1") {
if (useAlternateCard == 0 || validCard === "1") {
return AspenDiscovery.CloudLibrary.doCheckOut(patronId, id);
} else {
var url = Globals.path + "/CloudLibrary/" + id + "/AJAX?method=prepareAlternateLibraryCardPrompts&type=checkOutTitle&patronId=" + patronId;
Expand Down Expand Up @@ -198,7 +198,7 @@ AspenDiscovery.CloudLibrary = (function () {
var patronId = $("#patronId option:selected").val();
var useAlternateCard = $("#useAlternateLibraryCard").val();
var validCard = $("#patronId option:selected").attr("data-valid-card");
if (useAlternateCard === 0 || validCard === "1") {
if (useAlternateCard == 0 || validCard === "1") {
return AspenDiscovery.CloudLibrary.doHold(patronId, id);
} else {
var url = Globals.path + "/CloudLibrary/" + id + "/AJAX?method=prepareAlternateLibraryCardPrompts&type=placeHold&patronId=" + patronId;
Expand Down
Loading

0 comments on commit 5658283

Please sign in to comment.