Skip to content

Commit

Permalink
Initial v1.1 by Simmons College Library
Browse files Browse the repository at this point in the history
  • Loading branch information
mcalsada committed Mar 19, 2021
1 parent ae436a8 commit cef3e59
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Name>Internet Archive Search</Name>
<Author>Simmons College Library</Author>
<Version>1.1</Version>
<Active>true</Active>
<Description>Performs a search of internet archive for a loans' LoanTitle.</Description>
<Forms>
<Form>FormRequest</Form>
</Forms>
<Settings>
<Setting name="AutoSearch" value="true" type="boolean">
<Description>Defines whether the search should be automatically performed when the form opens.</Description>
</Setting>
</Settings>
<Files>
<File>InternetArchiveSearch.lua</File>
</Files>
</Configuration>
46 changes: 46 additions & 0 deletions InternetArchiveSearch.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
-- About InternetArchiveSearch.lua
--
-- Developed by Simmons College Library
--
-- Version 1.1, April 2010
--
-- InternetArchiveSearch.lua does search of Internet Archive for the LoanTitle for loans.
-- autoSearch (boolean) determines whether the search is performed automatically when a request is opened or not.
--
-- "query" is the text box name on archive.org

local autoSearch = GetSetting("AutoSearch");

local interfaceMngr = nil;
local browser = nil;

function Init()
if GetFieldValue("Transaction", "RequestType") == "Loan" then
interfaceMngr = GetInterfaceManager();

-- Create browser
browser = interfaceMngr:CreateBrowser("Internet Archive Search", "Internet Archive Search", "Script");

-- Create buttons
browser:CreateButton("Search", GetClientImage("Search32"), "Search", "Internet Archive");

browser:Show();

if autoSearch then
Search();
end
end
end

function Search()
browser:RegisterPageHandler("formExists", "searchform","SearchFormLoaded", false);
browser:Navigate("http://archive.org");
end

function SearchFormLoaded()
if GetFieldValue("Transaction", "RequestType") == "Loan" then
browser:SetFormValue("searchform", "search", GetFieldValue("Transaction", "LoanTitle"));
end
browser:ClickObject("gobutton");
end

0 comments on commit cef3e59

Please sign in to comment.