Navigation

4/22/2014

Sierra DNA: SQL query in Catalog





Generally, when we have a fixed field in a record that has a code and some description, there are a trio of views: x_property, x_property_name and x_property_myuser.  x_property relates the code to an internal database id.  x_property_name relates the internal database id to a description in some language.  x_property_myuser relates the code to the description in the language of the database user (set in Sierra Admin for the Sierra user your using to connect to the database).

If you try to the internal database id, you’ll get the wrong description; as you’ve seen.

Changing your SQL to use ptype_property_myuser, it becomes:

SELECT
   p.barcode                      AS barcode,
   p.ptype_code                   AS ptype,
   pt.name                        AS ptype_name,
   n.first_name                   AS first_name,
   n.last_name                    AS last_name
FROM sierra_view.varfield pz
 JOIN sierra_view.patron_view p
     ON pz.record_id = p.id
 JOIN sierra_view.ptype_property_myuser pt
     ON p.ptype_code = pt.value
 JOIN sierra_view.patron_record_fullname n
     ON n.patron_record_id = p.id
WHERE
 pz.varfield_type_code = 'z' AND UPPER(pz.field_content) LIKE UPPER('$email')
GROUP BY
  1,2,3,4,5

Note: If you start getting no rows at all, check that the Language for the Sierra user you are using is not set to None in Sierra Admin.


 Sierra listserv post from Jim Nicholls

4/14/2014

visual basic script to create URLs from a file directory

create file with .VBS extention, and then double click to run and create the output file with the URLs.


'2014-04 Len Davidson
'
'

On Error Resume Next
Dim fso, folder, files, NewsFile,sFolder

Set fso = CreateObject("Scripting.FileSystemObject")

' this code would take argument for folder name, I hardcode it below
' sFolder = Wscript.Arguments.Item(0)
' If sFolder = "" Then
' Wscript.Echo "No Folder parameter was passed"
' Wscript.Quit
' End If

sFolder = "folder-name-here"

Set NewFile = fso.CreateTextFile(sFolder&"\FileList.txt", True)
Set folder = fso.GetFolder(sFolder)
Set files = folder.Files

For each folderIdx In files
'  only want to include PDF files
If InStr(folderIdx.Name, ".pdf") > 0 Then
NewFile.WriteLine("http://your-server.com/mockup/test1/uploading/" & sFolder & "/" & folderIdx.Name)
end if
Next
NewFile.Close



Source

4/13/2014

NYC historical maps

NYPL has made historical maps available.


Last week, the New York Public Library released twenty thousand maps from its extensive collection, which includes more than four hundred thousand sheets and twenty thousand books and atlases, as free, high-resolution digital downloads. In announcing the newly accessible maps, the N.Y.P.L. explained that the holding includes more than a thousand maps of New York City from the seventeenth century to the twentieth century, “which detail transportation, vice, real estate development, urban renewal, industrial development and pollution, political geography among many, many other things.” Maps like these can be used to help historians visualize phenomena that have shaped the city. For example, they show how ethnic enclaves shifted as Italian, Jewish, and Chinese immigrants traded places in lower Manhattan or how Manhattan’s shoreline has grown outward, as a result of infill and real-estate speculation, creating new parts of the city where before there was only water.

From NewYorker

4/09/2014

Generating URLs from a list of files in a directory

This code will take file names from a directory (eg all mp3 files) and create a URL in an output file.txt





REM dir /B  > AAoutputURLs.txt
REM for /d %%A in (*.mp3) do echo ^<root^>^<dir^>%%~A^</dir^>^</root^> >> AAoutput1.txt

REM "cmd /c  echo   Unless you have opted out, the Law Library posts URL links to the “Class Recordings” list located at http://columbo.law.cua.edu/search/r?SEARCH=class.  Access to the URL links is restricted to current CUA law students only.   >> AAoutput1.txt"

REM "cmd /c  echo If you wish to post your specific URL link(s) onto your TWEN webpage, please include the alert message for Mac users.  Thank you.  >> AAoutput1.txt"


forfiles /M *.mp3  /C "cmd /c  echo http://136.242.14.49/law.cua.edu/academicexcellence/2014Spring/@file>> AAoutput1.txt"
REM forfiles /M *.mp4  /C "cmd /c  echo http://136.242.14.49/law.cua.edu/academicexcellence/2014Spring/@file>> AAoutput1.txt"
forfiles /M *.wmv  /C "cmd /c  echo http://136.242.14.49/law.cua.edu/academicexcellence/2014Spring/@file>> AAoutput1.txt"

REM  next line puts in date
echo %date:~4,10% >> AAoutput1.txt
echo( >> AAoutput1.txtpause

4/02/2014

javascript to highlight text, and to remove highlight

I had script to highlight text (using a div tag), but want to be able to quickly remove it, when I do another search, and want to highlight new phrase.




http://www.elated.com/articles/jquery-removing-replacing-moving-elements/



<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">

$( init );

function init() {

  // Remove the #myDiv element but leave its contents
  $('#myPara').unwrap();
}

</script>

</head>
<body>

  <div id="myDiv">
    <p id="myPara">A paragraph of text</p>
    <p>Another paragraph of text</p>
  </div>



http://www.the-art-of-web.com/javascript/search-highlight/  


Whole tag:
http://stackoverflow.com/questions/4232961/jquery-remove-a-tag-but-keep-innerhtml 






http://csdirect.iii.com/sierrahelp/Default.htm#sgcir_recent_circ_hist.html?Highlight=viewing%20the%20recent


http://csdirect.iii.com/sierrahelp/Content/Resources/Scripts/autoSearchComplete.js


function quickSearch(searchTerm) {
    if (searchTerm == "") {
        $("#autoCompleteContainer").html("");
        $("#autoCompleteContainer").append("<div id='search_suggestions_box'>Begin typing to begin your Quick Search</div>")
   
        return false;
    }
    var quickSearchArray = new Array();
    var quickSearchCount = 0;
    if (window.populatingURLS) {
        $("#search_suggestions_box").html("<span class='section_title'>Loading Data...</span>");
        return false;
    }
   

    $("#search_suggestions_box").html("<span class='section_title'>Full-Text Search</span><p id='search_text'> Continue searching for <span style='color:#B75F11'>\""+searchTerm+"\"</span> by clicking on the search icon</p><div id='suggestions_section' class='section'><span class='section_title' id='suggestions'>Documents with <span style='color:#B75F11'>\""+searchTerm+"\"</span> in the title<hr><div id='suggestions_list'><ul id='suggestions_list_ul'></ul></div></div>");
   
    myUrls = getLocalData("localStorageUrls")
    if (myUrls != undefined && (window.urls == undefined || window.urls == "" || window.urls.length <= 0)) {
        window.urls = JSON.parse(myUrls);
    }
    //Read in all of the url data
    for (x in window.urls) {
        urlData = window.urls[x];

        //IE refuses to let the below code continue. :(( Try catch is my solution for now
        try {
            t = urlData.Title;
            tLower = t.toLowerCase();
        }
        //If we fail here then just let the code fall through to return no change
        catch (e) {
            continue;
        }

        s = urlData.Source;
        //aLower = a.toLowerCase();
        searchTermLower = searchTerm.toLowerCase();
       
        searchPatt = new RegExp("("+searchTerm+")", "gi");
        if (tLower.match(searchTermLower) || s.toLowerCase().match(searchTermLower)) {
            t = t.replace(searchPatt, "<span class='mc-highlightSearch1'>$1</span>")
            //a = a.replace(searchPatt, "<span class='highlight' style='background:#ffc000'>$1</span>")
            s = s.replace(/\.\.\/Content\//g, "")+"?Highlight="+searchTerm.replace(/[^A-z0-9\.\s]/g, " ");
       
            if (window.modulesActive["highlight"]) {
                $("#suggestions_list_ul").append("<li ><A href='#"+s+"' onclick=\"$('#autoCompleteContainer').slideUp();highlightButtons('on')\">"+t+"</a></li>");
            }
            else {
            $("#suggestions_list_ul").append("<li ><A href='#"+s+"' onclick=\"$('#autoCompleteContainer').slideUp()\">"+t+"</a></li>");
            }
            quickSearchCount +=1;
            if (quickSearchCount > 20) {
                return false;
            }
        }
    }
}