X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=www%2Fmobile%2Fmobile_client.js;h=f7a0076960ba50d046a5d771742e3f0542378613;hb=8cc486015ba87bc3daf483d18d31d163c3670a21;hp=d024082ae90138257cee34042936778f1b09fd9a;hpb=1aae7216cdb9b022837a5a816bf68b21744ba6bc;p=pazpar2-moved-to-github.git diff --git a/www/mobile/mobile_client.js b/www/mobile/mobile_client.js index d024082..f7a0076 100644 --- a/www/mobile/mobile_client.js +++ b/www/mobile/mobile_client.js @@ -61,6 +61,17 @@ function checkOrientation() { } }; +function setQS (encodedParams) { + if ("onhashchange" in window) { + window.location.hash = '#' + encodedParams; + } else { + var url = document.location.href; + var i = url.indexOf("?"); + if (i > -1) url = url.substr(0, i); + document.location.href = url + "?" + encodedParams; + } +} + state.setRecPerPage(calcRecPerPage()); window.addEventListener("resize", checkOrientation, false); @@ -95,7 +106,6 @@ my_paz = new pz2( { "onshow": my_onshow, // pz2.js event handlers: // function my_onerror(error) { - alert("Unhandled error: " + error.code); switch(error.code) { // No targets! case "8": alert("No resources were selected for the search"); break; @@ -114,8 +124,8 @@ function my_onerror(error) { auth.check(loggedIn, login); break; default: - alert("Unhandled error: " + error.code); - throw error; // display error in JavaScript console + alert("Unhandled error: " + error.code); + throw error; // display error in JavaScript console } } @@ -192,11 +202,14 @@ function logInOrOut() { else logout(); } -function loggedIn() { +function loggedIn(context) { + + if (context.ipAuth != true) { var login = document.getElementById("login"); login.innerHTML = 'Logout'; document.getElementById("log").innerHTML = login.innerHTML; - domReady(); + } + domReady(); } function auth_check() { @@ -204,48 +217,6 @@ function auth_check() { //domReady(); } - -function auth_check_item(methods) { - auth.check(itemMain, function () { window.location = "login.html" + window.location.search + "&page="+window.location.pathname;}, methods ); -} - -//when page loads -function itemMain() { - mk_showPage(); - if (auth.styleCss && document.getElementById("stylesheet")) { - document.getElementById("stylesheet").href = auth.styleCss; - } - - // parse HTTP GET params (!!!) - window.location.parameters = parseQueryString(window.location.search); - var params = window.location.parameters; - // query params used by optional record_facets.js - if (window.RecordFacets != undefined) { - this.recordFacets = new RecordFacets(); - this.recordFacets.setRequestParams(params); - } - prefixRecId = params["prefixrecid"]; - query_state = params["query_state"]; - recQuery = params["recordquery"]; - // load templating components -/* - loadComponents(); - renderComponent("authLogoComp", auth); - renderComponent("authInfoComp", auth); - renderComponent("infoComp",null); - renderComponent("backToSearchComp",query_state); -*/ - my_paz = new pz2( {"pazpar2path": auth.servicePath, - "usesessions" : usesessions, - "errorhandler" : my_onerror, - "onrecord" : my_onrecord - }); - - // http params have highest priority - showDetails(prefixRecId,recQuery); -} - - // // Pz2.js event handlers: // @@ -481,10 +452,17 @@ function my_onterm(data) { termlists.push('

Subjects

'); termlists.push(''); termlists.push(''); @@ -492,13 +470,20 @@ function my_onterm(data) { termlists.push('

Authors

'); termlists.push(''); termlists.push(''); var termlist = document.getElementById("termlist"); @@ -896,7 +881,7 @@ function pagerPrev() { displayLoading(); state.curPage--; if (state.curPage <= 0) - throw "Zeo or negative current page"; + throw "Zero or negative current page"; } }