/** * File: parrotScript-001.js * Purpose: Support for AJAX calls to Parrot server for interactive functionality. * * Copyright 2015 Nigel Deans * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ var url; // get XML from servlet ................. function storylist_jsp(type) { console.log("...storylist_jsp(" + type + ")"); if (type=="short") url = "testapp?job=list-short"; if (type=="long") url = "testapp?job=list-long"; if (type=="special") url = "testapp?job=list-special"; $('div[id="list-view"]').load(url); } function storyview_jsp(story_id) { console.log("...storyview_jsp(" + story_id + ")"); url = "testapp?job=detail-short&storyid='" + story_id + "'"; $('div[id="detail-view"]').load(url); } // get XML from rest API ................. problem: only returning the IDs. function storylist_rst(type) { console.log("...storylist_rst(" + type + ")"); if (type=="short") url="rest/stories/short"; if (type=="long") url="rest/stories/long"; if (type=="special") url="rest/stories/special"; $('div[id="list-view"]').load(url); } function storyview_rst(story_name) { console.log("...storyview_rst('" + story_name + "')"); url = "testapp?job=detail-short&storyid='" + story_name + "'"; $('div[id="detail-view"]').load(url); } // get JSON from rest API .................... function storylist_rest(type) { console.log("...storyview_japi('" + type + "')"); url = "rest/stories/json/short"; $('div[id="list-view"]').load(url); } // load SWF .................................. function storylist_swf(type) { var swfObj = ""; console.log("...storylist_swf(" + type + ")"); if (type=="short") url="ParrotClient2.swf"; if (type=="long") url="ParrotClient2.swf"; if (type=="special") url="ParrotClient2.swf"; //$('div[name="flash-view"]').html(""); var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://"); swfObj = swfObj + ""; swfObj = swfObj + ""; swfObj = swfObj + ""; swfObj = swfObj + "

You don't have Flash installed... how lame.

"; swfObj = swfObj + "Get Adobe Flash player" swfObj = swfObj + "
"; $('div[id="flash-view"]').html(swfObj); $('div[id="flash-view"]').show(); } // load interactive resume HTML function show_resume(format) { console.log("loading resume..."); if (format == "html") { url="resume?jsp"; window.location = url; } if (format == "word") url="testapp?job=resword"; if (format == "PDF") url="resume?birt"; $('div[id="viewBox"]').load(url); } // utilities ........................ function check_webapp() { console.log(">> checking webapp"); url = "testapp?job=checkwa"; $('div[id="viewBox"]').load(url); } function check_data_jndi() { console.log(">> checking data connection 1..."); url = "testapp?job=checkdb1"; $('div[id="viewBox"]').load(url); } function check_data_drvmgmr() { console.log(">> checking data connection 2.."); url = "testapp?job=checkdb2"; $('div[id="viewBox"]').load(url); } function check_variables() { console.log(">> checking variables..."); url = "testapp?job=checkvars"; $('div[id="viewBox"]').load(url); } function clear_view() { console.log("clearing view..."); $('div[id="viewBox"]').html(""); }