diff --git a/JMolViewer/jmol.htm b/JMolViewer/jmol.htm index 9e1bda88b7..8cc0de46c3 100644 --- a/JMolViewer/jmol.htm +++ b/JMolViewer/jmol.htm @@ -1,104 +1,284 @@ JMol Example - + - - -
+ -
+
- + + + + +
- -
\ No newline at end of file diff --git a/XMLEngine.swf b/XMLEngine.swf index 1f3e36282b..1cbacad4f6 100644 Binary files a/XMLEngine.swf and b/XMLEngine.swf differ diff --git a/modules/xerte/parent_templates/Nottingham/data.xwd b/modules/xerte/parent_templates/Nottingham/data.xwd index 173d99ab93..6d74b49dce 100644 --- a/modules/xerte/parent_templates/Nottingham/data.xwd +++ b/modules/xerte/parent_templates/Nottingham/data.xwd @@ -71,7 +71,7 @@ ]]> ]]> - ]]> + ]]> ]]> ]]> ]]> @@ -250,20 +250,26 @@ + + - + + + + + + - diff --git a/modules/xerte/parent_templates/Nottingham/models/jmol.rlm b/modules/xerte/parent_templates/Nottingham/models/jmol.rlm index 2dc0afd6ff..7e92e26cac 100644 --- a/modules/xerte/parent_templates/Nottingham/models/jmol.rlm +++ b/modules/xerte/parent_templates/Nottingham/models/jmol.rlm @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/xerte/preview.php b/modules/xerte/preview.php index c1830b86db..d44712e00b 100644 --- a/modules/xerte/preview.php +++ b/modules/xerte/preview.php @@ -75,9 +75,185 @@ function enableTTS(){ VoiceObj = new ActiveXObject("Sapi.SpVoice"); } } + function openWindow(params){ window.open(params.url,'xerte_window',"status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0,scrollbars=0,left=" + String((screen.width / 2) - (params.width / 2)) + ",top=" + String((screen.height / 2) - (params.height / 2)) + ",height=" + params.height + ",width=" + params.width); } + + var popupInfo = new Array(); + var stageW; + var stageH; + var screenSize; + + function makePopUp(params) { + //kill any existing popups + var popup = document.getElementById("popup"); + var parent = document.getElementById("popup_parent"); + + if (popup != null) { + parent.removeChild(popup); + } + + //make the div and style it + var create_div = document.createElement("DIV"); + create_div.id = params.id; + create_div.style.position = "absolute"; + create_div.style.background = params.bgColour; + if (params.borderColour != "none") { + create_div.style.border = "1px solid " + params.borderColour; + } + + stageW = params.width; + stageH = params.height; + if (stageW == 1600 && stageH == 1200) { + stageW = document.getElementsByTagName('body')[0].clientWidth; + stageH = document.getElementsByTagName('body')[0].clientHeight; + } + if (screenSize == "full screen") { + calcStageSize(); + } + + // save info about popup to use if screen resized + var index = popupInfo.length; + popupInfo[index] = new Array(); + popupInfo[index][0] = params.id; + popupInfo[index][1] = params.type; + popupInfo[index][2] = params.calcW; + popupInfo[index][3] = params.calcH; + popupInfo[index][4] = params.calcX; + popupInfo[index][5] = params.calcY; + + if (screenSize == "fill window") { + create_div.style.width = params.calcW + "%"; + create_div.style.height = params.calcH + "%"; + create_div.style.left = params.calcX + "%"; + create_div.style.top = params.calcY + "%"; + } else { + create_div.style.width = calcPopupSize("width", index) + "px"; + create_div.style.height = calcPopupSize("height", index) + "px"; + create_div.style.left = calcPopupSize("x", index) + "px"; + create_div.style.top = calcPopupSize("y", index) + "px"; + } + + if (params.type == 'div') { + create_div.innerHTML = params.src; + } else { + var iframe_create_div = document.createElement("IFRAME"); + iframe_create_div.id = "i" + params.id; + iframe_create_div.name = "i" + params.id; + iframe_create_div.src = params.src; + if (params.type == 'jmol') { + iframe_create_div.src += ',width=' + calcPopupSize("width", index) + ',height=' + calcPopupSize("height", index); + } + iframe_create_div.style.width = "100%"; + iframe_create_div.style.height = "100%"; + iframe_create_div.frameBorder = 'no'; + create_div.appendChild(iframe_create_div); + } + + //finally append the div + parent.appendChild(create_div); + } + + function killPopUp() { + var parent = document.getElementById("popup_parent"); + if (parent.hasChildNodes()) { + while (parent.childNodes.length >= 1) { + parent.removeChild(parent.firstChild); + popupInfo.splice(0, popupInfo.length); + } + } + } + + function calcPopupSize(type, index) { + var num; + if (type == "width") { + num = stageW / 100 * popupInfo[index][2]; + } else if (type == "height") { + num = stageH / 100 * popupInfo[index][3]; + } else if (type == "x") { + num = stageW / 100 * popupInfo[index][4]; + } else if (type == "y") { + num = stageH / 100 * popupInfo[index][5]; + } + return num; + } + + function calcStageSize() { + if (stageH / stageW != 0.75) { + var ratio = stageH / stageW; + if (ratio > 0.75) { + stageH = stageW * 0.75; + } else { + stageW = stageH / 0.75; + } + } + } + + function resizePopup(type, width, height) { + if (screenSize != type && !(screenSize == undefined && type == "default")) { + var parent = document.getElementById("popup_parent"); + if (parent.hasChildNodes()) { + if (type == "fill window") { + for (i=0; i