Skip to content
Browse files

Bug fix addresses Issues #66 #67

  • Loading branch information...
1 parent bf0c412 commit b464710e6a4a568da98ab0f4a56468916d899bb8 @jermnelson committed Aug 27, 2012
View
14 aristotle/apps/discovery/discovery_apps.py
@@ -35,14 +35,18 @@ def json_search(self,request):
:param request: Django request
"""
call_number = request.REQUEST.get('q')
- params = {"call_number":urllib.unquote(call_number),
- "slice-size":int(settings.ITEMS_PER_PAGE) - 3}
+ if request.REQUEST.has_key("number_type"):
+ number_type = request.REQUEST.get('number_type')
+ else:
+ number_type = 'lccn'
context = {'docs':None}
json_search_url = os.path.join(self.call_number_url,
'term_search')
- json_search_url = "{0}?call_number={1}&slice-size={2}".format(json_search_url,
- call_number.strip(),
- int(settings.ITEMS_PER_PAGE) - 3)
+ json_search_url = "{0}?call_number={1}&slice-size={2}&type={3}".format(json_search_url,
+ call_number.strip(),
+ int(settings.ITEMS_PER_PAGE) - 3,
+ number_type)
+
json_results = urllib2.urlopen(json_search_url).read()
results = json.load(urllib2.urlopen(json_search_url))
if len(results.get("bib_numbers")) > 0:
View
2 aristotle/apps/discovery/management/commands/index.py
@@ -36,7 +36,7 @@
import django.conf as conf
import django.core.management.base as mb
-CSV_FILE = 'tmp.csv'
+CSV_FILE = 'tmp{0}.csv'.format(time.time())
class Command(mb.BaseCommand):
option_list = mb.BaseCommand.option_list + (
View
8 aristotle/apps/discovery/media/discovery/js/discovery.js
@@ -248,3 +248,11 @@ function ShowCart(session_id) {
});
}
+
+function toggle_num_search() {
+ if($("#search_type").val() == "number_search") {
+ window.location = "/catalog/search?search_type=number_search";
+ } else {
+ window.location = "/catalog/";
+ }
+}
View
160 aristotle/apps/discovery/parsers/tutt_maps.py
@@ -1,6 +1,161 @@
#
# Tutt library III location codes
#
+FULL_CODE_MAP = {
+ 'ewww':'Online',
+ 'ewwwd':'Online Government Documents',
+ 'ewwwp':'Online Periodcals',
+ 'ewwwn':'Online',
+ 'tarf':'Tutt Reference',
+ 'tarfa':'Tutt 1st Floor South',
+ 'tarfc':'Tutt Reference',
+ 'tarfd':'Tutt Reference Desk',
+ 'tarfg':'Tutt Reference Desk',
+ 'tarfi':'Tutt Reference',
+ 'tarfm':'Tutt Reference North 2nd Floor',
+ 'tarfo':'Tutt Reference North 2nd Floor',
+ 'tban':'Art Reading Room Tutt 2nd Floor South',
+ 'tbanf':'Art Reading Room Tutt 2nd Floor South',
+ 'tb':'Tutt 3rd Floor',
+ 'tbnc':'Tutt 3rd Floor',
+ 'tbndp':'Tutt Display',
+ 'tbnew':'Tutt New Arrivals',
+ 'tbp':'Tutt North Basement',
+ 'tbpnc':'Tutt North Basement',
+ 'tcat':'Tutt Cataloging Office',
+ 'tcas':'CDROM/Cassette Tutt Circulation Desk',
+ 'tcbs':'Tutt Leisure Reading',
+ 'tcurr':'Tutt 3rd Floor',
+ 'tdacd':'Government Documents CD-ROM index',
+ 'tfly':'On The Fly',
+ 'tgr':'Tutt North Basement',
+ 'tor':'Technical Services',
+ 'tr':'On Order',
+ 'tre':'Electronic Reserves',
+ 'trp':'Reserves Tutt 1st Floor',
+ 'trrm':'Reserves Tutt 1st Floor',
+ 'trs':'Reserves Tutt 1st Floor',
+ 'trsdo':'Reserves Tutt 1st Floor',
+ 'trstv':'Reserves Tutt 1st Floor',
+ 'td':'Tutt South Basement',
+ 'tdo':'Tutt South Basement',
+ 'tdcol':'Tutt South Basement',
+ 'tde':'Tutt South Basement',
+ 'tdea':'Tutt South Basement',
+ 'tdem':'Tutt South Basement',
+ 'tdemc':'Tutt South Basement',
+ 'tdn':'Tutt South Basement',
+ 'tdi':'Tutt 1st Floor South',
+ 'tdm':'Tutt 1st Floor South',
+ 'tdmt':'Tutt 1st Floor South',
+ 'tdmf':'Tutt 1st Floor South',
+ 'tdmi':'Microforms Tutt 2nd Floor',
+ 'tdof':'Tutt 1st Floor South',
+ 'tdscs':'Tutt 1st Floor South',
+ 'tmaps':'Tutt North 2nd Floor Map File',
+ 'tmi':'Microforms Tutt 2nd Floor',
+ 'tmic':'Microforms Tutt 2nd Floor',
+ 'tmico':'Microforms Tutt 2nd Floor',
+ 'tmics':'Microforms Tutt 2nd Floor',
+ 'tmifs':'Microforms Tutt 2nd Floor',
+ 'tt':'Tutt North Basement Theses',
+ 'ttlc':'Teaching Learning Center',
+ 'ttla':'Tutt North Basement Lit Award',
+ 'xfb':'Fine Arts Center',
+ 'xm':'Music Library Books and Scores',
+ 'xmcas':'Music Library Cassette',
+ 'xmcat':'Music Library Catalog Office',
+ 'xmcd':'Music Library CD-ROM',
+ 'xmcir':'Music Library Circ Desk',
+ 'xmdvd':'Music Library DVD',
+ 'xmedd':'Music Library Education DVD',
+ 'xmh':'Music Library -NC Books and Scores',
+ 'xmhs':'Music Library -NC Storage',
+ 'xmhsm':'Music Library -NC Music Mini Scores',
+ 'xmins':'Music Lib. -Instrument Storage',
+ 'xmld':'Music Library',
+ 'xmlp1':'Music Library LP/SLP Room',
+ 'xmmcd':'Music Library Music CD',
+ 'xmmi':'Music Library Microforms',
+ 'xmo':'Music Library Oversize',
+ 'xmr':'Music Library Reference',
+ 'xmper':'Music Library Periodicals',
+ 'xms':'Music Library Storage',
+ 'xmr':'Music Library Reference',
+ 'xmrt':'Music Library Reel Tape',
+ 'xmrs':'Music Library Reserves',
+ 'xmscm':'Music Library MiniScores',
+ 'xmv':'Music Library Video',
+ 'tper':'Periodicals Tutt 2nd Floor',
+ 'tpero':'Periodicals Tutt 2nd Floor',
+ 'tdmo':'Oversize Tutt 2nd Floor',
+ 'tf':'Folio Tutt 3rd Floor',
+ 'to':'Oversize Tutt 3rd Floor',
+ 'tsa':'Special Collections Audio',
+ 'tlr':'Special Collections Lincoln Room',
+ 'tlrc':'Special Collections Lincoln Room Small',
+ 'tlrf':'Special Collections Lincoln Room Folio',
+ 'tlro':'Special Collections Lincoln Room Oversize',
+ 'tlrp':'Special Collections Lincoln Room Periodical',
+ 'tlrpa':'Special Collections Lincoln Room Pamphlet',
+ 'tscc':'Special Collections CC Room',
+ 'tsccf':'Special Collections CC Room Folio',
+ 'tscco':'Special Collections CC Room Oversize',
+ 'tsccp':'Special Collections CC Room Periodical ',
+ 'tsnv':'Special Collections CC Room Pamphlet ',
+ 'tsco':'Special Collections Colorado Room',
+ 'tscof':'Special Collections Colorado Room Folio',
+ 'tscoo':'Special Collections Colorado Room Oversize',
+ 'tscop':'Special Collections Colorado Room Periodical',
+ 'tsm':'Special Collections Maps',
+ 'tsmi':'Special Collections Microform',
+ 'tsmf':'Special Collections Manuscripts File',
+ 'tsms':'Special Collections Manuscripts',
+ 'tsof':'Special Collections Offices',
+ 'tsra':'Special Collections Rare',
+ 'tsraf':'Special Collections Rare Folio',
+ 'tsrao':'Special Collections Rare Oversize',
+ 'tsrat':'Special Collections Rare Small',
+ 'tsse':'Special Collections Special Editions',
+ 'tssef':'Special Collections Special Editions Folio',
+ 'tsseo':'Special Collections Special Editions Oversize',
+ 'tsset':'Special Collections Special Editions Small',
+ 'tssto':'Special Collections Storage Basement',
+ 'tsv':'Special Collections Videos',
+ 'tv':'Videos-Tutt 2nd Floor North',
+ 'tvc':'Video-Tutt Circulation Desk',
+ 'tvdvd':'DVD-Tutt Circulation Desk',
+ 'xbaca':'Baca Campus',
+ 'xfb':'Fine Arts Center',
+ 'xfcab':'Fine Arts Center',
+ 'xfdsk':'Fine Arts Center',
+ 'xfdvd':'Fine Arts Center',
+ 'xffil':'Fine Arts Center',
+ 'xfup':'Fine Arts Center',
+ 'xfo':'Fine Arts Center',
+ 'xfv':'Fine Arts Center',
+ 'xsan':'Anthropology Seminar-Barnes',
+ 'xsby':'Biology Seminar-Olin',
+ 'xsbyo':'Biology Seminar-Olin',
+ 'xsch':'Barnes Chemistry Library',
+ 'xscho':'Barnes Chemistry Library',
+ 'xsed':'Education Dept. (Mierow)',
+ 'xsedc':'Education Dept. (Mierow)',
+ 'xsedl':'Education Dept. Computer Lab',
+ 'xsedp':'Education Dept. (Mierow)',
+ 'xserc':'Environmental Science Seminar',
+ 'xsetv':'Environmental Science Seminar',
+ 'xsgeo':'Geology Map Room',
+ 'xsgix':'Keck GIS Commons',
+ 'xsgm':'Geology Map Room',
+ 'xsmat':'Math Seminar-Palmer',
+ 'xsph':'Physics Seminar-Barnes',
+ 'xspho':'Physics Seminar-Barnes',
+ 'xsps':'Political Science Seminar-Palmer',
+ 'xsrus':'Russian Seminar-Armstrong',
+ 'xwebb':'Penrose Hospital',
+}
+
LOCATION_CODE_MAP = {
'ewww':'Online',
'ewwwd':'Online',
@@ -205,10 +360,7 @@
'tsseo':'Special Collections Special Editions',
'tsset':'Special Collections Special Editions',
'tssto':'Special Collections Storage Basement',
- 'tsv':'Special Collections Videos',
- 'tv':'Videos-Tutt 2nd Floor North',
- 'tvc':'Video-Tutt Circulation Desk',
- 'tvdvd':'DVD-Tutt Circulation Desk'}
+ 'tsv':'Special Collections Videos'}
View
1 aristotle/apps/discovery/templatetags/discovery_extras.py
@@ -257,6 +257,7 @@ def get_google_book(num_isbn,size='small'):
params = urllib.urlencode({'q':'isbn:{0}'.format(num_isbn),
'key':GBS_API_KEY})
google_book_url = 'https://www.googleapis.com/books/v1/volumes?{0}'.format(params)
+ print(google_book_url)
try:
book_json = simplejson.load(urllib2.urlopen(google_book_url))
except:
View
2 aristotle/apps/discovery/views.py
@@ -1,4 +1,4 @@
-# Copyright 2007 Casey Durfee
+
# Copyright 2008 Gabriel Sean Farrell
#
# This file is part of Kochief.
View
8 aristotle/apps/vendors/iii/bots/iiibots.py
@@ -8,7 +8,7 @@
import csv,re
from eulxml import xmlmap
from vendors.iii.models import ItemRecord,IIIStatusCode,Fund,FundProcessLog
-from discovery.parsers.tutt_maps import LOCATION_CODE_MAP
+from discovery.parsers.tutt_maps import FULL_CODE_MAP
from settings import ILS_PATRON_URL
from BeautifulSoup import BeautifulSoup
@@ -157,15 +157,15 @@ def callnumber(self):
def location(self):
"""
Retrieves location code from XML and then does a look-up
- using the discovery.parsers.tutt_map LOCATION_CODE_MAP
- for the human-friendly facet label
+ using the discovery.parsers.tutt_map FULL_CODE_MAP for the
+ actual full denormalized location.
:rtype: string
"""
location = None
if self.item_xml is not None:
try:
- location = LOCATION_CODE_MAP[self.item_xml.location_code.strip()]
+ location = FULL_CODE_MAP[self.item_xml.location_code.strip()]
except KeyError:
location = 'Unknown location code %s' % self.item_xml.location_code
return location
View
346 aristotle/apps/vendors/iii/fixures/status.json
@@ -1,92 +1,258 @@
[
- {
- "fields": {
- "code":"-",
- "value": "In Library"
- },
- "model": "iii.IIIStatusCode",
- "pk":1
- },
- {
- "fields": {
- "code":"j",
- "value": "Online"
- },
- "model": "iii.IIIStatusCode",
- "pk":2
- },
- {
- "fields": {
- "code":"h",
- "value": "Library use only"
- },
- "model": "iii.IIIStatusCode",
- "pk":3
- },
- {
- "fields": {
- "code":"m",
- "value":"Missing"
- },
- "model": "iii.IIIStatusCode",
- "pk":4
- },
- {
- "fields": {
- "code":"$",
- "value":"Lost and Paid"
- },
- "model": "iii.IIIStatusCode",
- "pk":5
- },
- {
- "fields": {
- "code":"!",
- "value":"On hold shelf"
- },
- "model": "iii.IIIStatusCode",
- "pk":6
- },
- {
- "fields": {
- "code":"d",
- "value":"Mending"
- },
- "model": "iii.IIIStatusCode",
- "pk":7
- },
- {
- "fields": {
- "code":"r",
- "value":"Being replaced"
- },
- "model": "iii.IIIStatusCode",
- "pk":8
- },
- {
- "fields": {
- "code":"g",
- "value":"CC Use Only"
- },
- "model": "iii.IIIStatusCode",
- "pk":9
- },
- {
- "fields": {
- "code":"a",
- "value":"Being digitized"
- },
- "model": "iii.IIIStatusCode",
- "pk":10
- },
- {
- "fields": {
- "code":"n",
- "value":"Billed"
- },
- "model": "iii.IIIStatusCode",
- "pk":11
- }
-
-
+ {
+ "fields": {
+ "code": "-",
+ "value": "In"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 1
+ },
+ {
+ "fields": {
+ "code": "i",
+ "value": "Review Shelf"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 2
+ },
+ {
+ "fields": {
+ "code": "a",
+ "value": "Being Digitized"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 3
+ },
+ {
+ "fields": {
+ "code": "b",
+ "value": "At Bindery"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 4
+ },
+ {
+ "fields": {
+ "code": "q",
+ "value": "Education Dept"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 5
+ },
+ {
+ "fields": {
+ "code": "c",
+ "value": "Art Education"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 6
+ },
+ {
+ "fields": {
+ "code": "d",
+ "value": "Mending"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 7
+ },
+ {
+ "fields": {
+ "code": "e",
+ "value": "On Order"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 8
+ },
+ {
+ "fields": {
+ "code": "g",
+ "value": "Cc Only"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 9
+ },
+ {
+ "fields": {
+ "code": "f",
+ "value": "Envir Science"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 10
+ },
+ {
+ "fields": {
+ "code": "h",
+ "value": "Lib Use Only"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 11
+ },
+ {
+ "fields": {
+ "code": "j",
+ "value": "On-Line"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 12
+ },
+ {
+ "fields": {
+ "code": "k",
+ "value": "Fine Arts Ctr"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 13
+ },
+ {
+ "fields": {
+ "code": "l",
+ "value": "Lost"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 14
+ },
+ {
+ "fields": {
+ "code": "m",
+ "value": "Missing"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 15
+ },
+ {
+ "fields": {
+ "code": "n",
+ "value": "Billed"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 16
+ },
+ {
+ "fields": {
+ "code": "p",
+ "value": "In Processing"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 17
+ },
+ {
+ "fields": {
+ "code": "r",
+ "value": "Being Replaced"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 18
+ },
+ {
+ "fields": {
+ "code": "s",
+ "value": "On Search"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 19
+ },
+ {
+ "fields": {
+ "code": "t",
+ "value": "In Transit"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 20
+ },
+ {
+ "fields": {
+ "code": "&",
+ "value": "Requested"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 21
+ },
+ {
+ "fields": {
+ "code": "y",
+ "value": "Not Yet Receiv"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 22
+ },
+ {
+ "fields": {
+ "code": "z",
+ "value": "Clms Retd"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 23
+ },
+ {
+ "fields": {
+ "code": "%",
+ "value": "Returned"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 24
+ },
+ {
+ "fields": {
+ "code": "!",
+ "value": "On Holdshelf"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 25
+ },
+ {
+ "fields": {
+ "code": "#",
+ "value": "Prospector Received"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 26
+ },
+ {
+ "fields": {
+ "code": "$",
+ "value": "Lost And Paid"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 27
+ },
+ {
+ "fields": {
+ "code": "*",
+ "value": "Missing"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 28
+ },
+ {
+ "fields": {
+ "code": "@",
+ "value": "Off Campus"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 29
+ },
+ {
+ "fields": {
+ "code": "(",
+ "value": "Prospector Paged"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 30
+ },
+ {
+ "fields": {
+ "code": "X",
+ "value": "Open Reserve"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 31
+ },
+ {
+ "fields": {
+ "code": ")",
+ "value": "Prspctr Cncld"
+ },
+ "model": "iii.IIIStatusCode",
+ "pk": 32
+ }
]
View
6 aristotle/templates/discovery/snippets/cc-simple-search.html
@@ -6,12 +6,14 @@
<img src="{{ STATIC_URL }}img/bg/library/mag-glass.png" />
</td>
<td>
- <select name="search_type" style="width:100px">
+ <select name="search_type" id="search_type" {% comment %}onchange="toggle_num_search()"{% endcomment %} style="width:100px">
<option value="search" {% if request.REQUEST.search_type == 'select' %}selected="SELECTED"{% endif %}>Keyword</option>
<option value="author_search" {% if request.REQUEST.search_type == 'author_search' %}selected="SELECTED"{% endif %}>Author</option>
<option value="title_search" {% if request.REQUEST.search_type == 'title_search' %}selected="SELECTED"{% endif %}>Title</option>
<option value="subject_search" {% if request.REQUEST.search_type == 'subject_search' %}selected="SELECTED"{% endif %}>Subject</option>
+{% comment %}
<option value="number_search" {% if request.REQUEST.search_type == 'number_search' %}selected="SELECTED"{% endif %}>Number</option>
+{% endcomment %}
<option value="jrnl_title_search" {% if request.REQUEST.search_type == 'jrnl_title_search' %}selected="SELECTED"{% endif %}>Journal Title</option>
</select>
</td>
@@ -35,6 +37,7 @@
<input type="submit" class="btn" value="Go"></input>
</td>
</tr>
+{% comment %}
<tr>
<td>
<label class="checkbox">
@@ -47,5 +50,6 @@
</td>
{% endif %}
</tr>
+{% endcomment %}
</table>
</form>

0 comments on commit b464710

Please sign in to comment.
Something went wrong with that request. Please try again.