Location: Goldbeter 2006 @ e51f2a391286 / goldbeter_2006.xul

Author:
Dougal Cowan <devnull@localhost>
Date:
2011-05-16 08:59:33+12:00
Desc:
relativized the imports
Permanent Source URI:
https://teaching.physiomeproject.org/workspace/goldbeter_2006/rawfile/e51f2a3912860c260122acb53a46d4a8040dbae5/goldbeter_2006.xul

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="layout-diagram" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" style="overflow: auto" onload="setupDocument()">
<hbox>
	<scale id="zoom_scale" value="10" min="7" max="14" flex="4"/>
	<label value="Zoom" control="zoom_scale" flex="1"/>
	<button id="reset_button" label="Reset View" flex="1"/>
	<spacer flex="34"/>
</hbox>
<script>
<![CDATA[
window.model_entities =
  {

			
	P: {
		id: "P",
		y: "P/P",
		x: "environment/time",
		graph: "Sustained oscillations generated by the model for weight cycling",
		colour: "#ff9900",
		linestyle: "none"
	},

	Q: {
		id: "Q",
		y: "Q/Q",
		x: "environment/time",
		graph: "Sustained oscillations generated by the model for weight cycling",
		colour: "#ff00cc",
		linestyle: "none"
	},

	R: {
		id: "R",
		y: "R/R",
		x: "environment/time",
		graph: "Sustained oscillations generated by the model for weight cycling",
		colour: "#cc00ff",
		linestyle: "none"
}

	
			
 // Repeat the above section for each controllable graph trace.
 // Remember to add a comma to each repeat after the final },
 // except for the final one!
 
};

function flushVisibilityInformation(entity_id, entity_colour)
{
	var message = "";
	var entity;

	if (typeof pcenv != "undefined")
	{
		for (var i in window.model_entities)
		{
			entity = window.model_entities[i];
			if (typeof entity_id == "undefined" || entity_id == window.model_entities[i].id)
			{
				pcenv.selectTrace
				(
					entity.graph,
					entity.x,
					entity.y,
					typeof entity_colour == "undefined" ? "" : entity_colour,
					entity.linestyle
				);
			}
			if (entity.linestyle != "none")
				message += i + ", ";
		}
		pcenv.status(message == "" ? "No fluxes displayed" : "Displaying flux of " + message.slice(0, -2));
	}
}

function processSelectEntity(event)
{
	if (typeof pcenv != "undefined")
		pcenv.status("In processSelectEntity");

	var entity = window.model_entities[window.svgIdToName[event.currentTarget.id]];

	switch(entity.linestyle)
	{
	case "none":
		entity.linestyle = "lines";
		highlightEntity(event.currentTarget.id);
		break;
	case "lines":
		entity.linestyle = "none";
		unlightEntity(event.currentTarget.id);
		break;
	}

	flushVisibilityInformation(entity.id);
}

function processContext(event)
{
	// if (event.button != 2)
	//   return true;

	var entity = window.model_entities[window.svgIdToName[event.currentTarget.id]];

	if (entity.context == null)
		return true;

	var menu = document.getElementById("entityContextMenu");

	for (var c = menu.firstChild, x = null; c != null; c = x)
	{
		x = c.nextSibling;
		menu.removeChild(c);
	}

	for (var i in entity.context)
	{
		var item = entity.context[i];

		var mitem = document.createElementNS
		(
			"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
			"menuitem"
		);

		mitem.setAttribute("label", item.label);
		mitem.setAttribute("url", item.url);
		mitem.addEventListener("command", processShowEntityURL, false);
		menu.appendChild(mitem);
	}

	menu.showPopup(window.diagram, event.screenX, event.screenY, "context");

	event.stopPropagation;
	return false;
}

function processShowEntityURL(event)
{
	url = event.target.getAttribute("url");

	window.open(url);

	var hl = document.getElementById("hidden-link");
	hl.href = url;

	// This is ugly, but it is one way to force everything through the proper
	// external handler...
	var evt = document.createEvent("HTMLEvents");
	evt.initEvent("click", true, true);
	hl.dispatchEvent(evt);
}

function highlightEntity(id)
{
	for (var path = document.getElementById(id + "_path1"), i = 1; path != null; path = document.getElementById(id + "_path" + ++i))
	{
		if (!(i in window.model_entities[window.svgIdToName[id]].path_colours))
			window.model_entities[window.svgIdToName[id]].path_colours[i] = path.attributes.getNamedItem("stroke").value;
		path.attributes.getNamedItem("stroke").value = "#ff0000";
	}
}

function highlightEntityOnRollover(event) {
	if (window.model_entities[window.svgIdToName[event.currentTarget.id]].colour)
		flushVisibilityInformation(event.currentTarget.id, "#ffffff");

	if (window.model_entities[window.svgIdToName[event.currentTarget.id]].linestyle == "none")
		highlightEntity(event.currentTarget.id);
}

function unlightEntity(id)
{
	for (var path = document.getElementById(id + "_path1"), i = 1; path != null; path = document.getElementById(id + "_path" + ++i))
		path.attributes.getNamedItem("stroke").value = window.model_entities[window.svgIdToName[id]].path_colours[i];
}

function unlightEntityOnRollover(event) {
	if (window.model_entities[window.svgIdToName[event.currentTarget.id]].colour)
		flushVisibilityInformation(event.currentTarget.id, window.model_entities[window.svgIdToName[event.currentTarget.id]].colour);

	if (window.model_entities[window.svgIdToName[event.currentTarget.id]].linestyle == "none")
		unlightEntity(event.currentTarget.id);
}

var mouseDown = false;
var initial_x;
var initial_y;
var viewBox;

function startDrag(event)
{
	if (event.button)
		return true;

	mouseDown = true;

	initial_x = parseInt(currentZoom * event.pageX + parseInt(viewBox.value.match(/^-?\d+/)[0]));
	initial_y = parseInt(currentZoom * event.pageY + parseInt(viewBox.value.match(/^-?\d+\s+(-?(\d+))/)[1]));
}

function stopDrag(event)
{
	if (!event.button)
		mouseDown = false;
}

function moveDrag(event)
{
	if (mouseDown == true)
		viewBox.value = viewBox.value.replace(/^-?\d+\s+-?\d+/, parseInt(initial_x - currentZoom * event.pageX) + " " + parseInt(initial_y - currentZoom * event.pageY));
}

function reset()
{
	var zoom_scale = document.getElementById("zoom_scale")
	zoom_scale.value = zoom_scale.originalValue;
	viewBox.value = viewBox.originalValue;
}

var initialZoom;
var currentZoom = 1;
var initialHeight;
var initialWidth;

function zoomDiagram(event)
{
	currentZoom = initialZoom / event.currentTarget.value;
	viewBox.value = viewBox.value.replace(/\d+\s+\d+$/, parseInt(initialHeight * currentZoom) + " " + parseInt(initialWidth * currentZoom));
}

function setupDocument()
{
	flushVisibilityInformation();

	window.diagram = document.getElementById("sachse");

	window.svgIdToName = {};

	for (var name in window.model_entities)
	{
		var id = window.model_entities[name].id;
		window.model_entities[name].path_colours = [];

		var svg = document.getElementById(id);
		window.svgIdToName[id] = name;

		svg.addEventListener("click", processSelectEntity, false);
		svg.addEventListener("contextmenu", processContext, false);
		svg.addEventListener("mouseover", highlightEntityOnRollover ,false);
		svg.addEventListener("mouseout", unlightEntityOnRollover, false);
	}

	document.getElementsByTagName("svg")[0].addEventListener("mousedown", startDrag, false);
	document.addEventListener("mouseup", stopDrag, false);
	document.addEventListener("mousemove", moveDrag, false);
	document.getElementById("reset_button").addEventListener("click", reset, false);

	document.getElementById("zoom_scale").addEventListener("change", zoomDiagram, false);
	document.getElementById("zoom_scale").originalValue = document.getElementById("zoom_scale").value;

	viewBox = document.getElementsByTagName("svg")[0].attributes.getNamedItem("viewBox");
	viewBox.originalValue = viewBox.value;

	initialZoom = document.getElementById("zoom_scale").value;
	initialHeight = parseInt(viewBox.value.match(/(\d+)\s+\d+$/)[1]);
	initialWidth = parseInt(viewBox.value.match(/\d+$/)[0]);
}

]]>
</script>

<popupset>
  <menupopup id="entityContextMenu" />
</popupset>

<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
	 width="423px" height="486px" viewBox="0 0 423 486" enable-background="new 0 0 423 486" xml:space="preserve">

<g>
	<g>
		<path fill="none" stroke="#010101" d="M18.507,37.198c23.239-27.796,61.599-29.683,87.036-3.994"/>
		<polygon fill="#010101" points="100.934,33.814 104.673,32.326 106.198,28.603 109.742,37.445 		"/>
	</g>
</g>
<g>
	<g>
		<path fill="none" stroke="#010101" d="M109.615,54.117C86.738,83.159,48.401,85.468,22.629,59.06"/>
		<polygon fill="#010101" points="27.242,58.482 23.493,59.944 21.94,63.656 18.46,54.787 		"/>
	</g>
</g>
<g>
	<path d="M11.054,43.04H11.03l-1.355,0.731l-0.204-0.803l1.703-0.912h0.9v7.796h-1.02V43.04z"/>
	<path d="M17.702,46.23v0.768h-2.962V46.23H17.702z"/>
	<path d="M25.812,51.04c-1.092-0.288-2.159-0.612-3.095-0.936c-0.18-0.06-0.335-0.12-0.492-0.12
		c-1.931-0.072-3.562-1.487-3.562-4.102c0-2.591,1.571-4.258,3.754-4.258c2.207,0,3.634,1.703,3.634,4.09
		c0,2.087-0.959,3.406-2.303,3.886v0.048c0.803,0.204,1.679,0.396,2.363,0.516L25.812,51.04z M24.948,45.774
		c0-1.631-0.839-3.298-2.555-3.298c-1.763,0-2.626,1.631-2.626,3.382c0,1.728,0.936,3.274,2.591,3.274
		C24.012,49.133,24.948,47.609,24.948,45.774z"/>
</g>
<g>
	<g>
		<path fill="none" stroke="#010101" d="M161.017,205.813c-23.239-27.796-61.599-29.683-87.036-3.994"/>
		<polygon fill="#010101" points="73.325,197.218 74.85,200.941 78.589,202.43 69.78,206.061 		"/>
	</g>
</g>
<g>
	<g>
		<path fill="none" stroke="#010101" d="M69.908,223.732c22.877,29.042,61.215,31.351,86.986,4.942"/>
		<polygon fill="#010101" points="157.583,233.271 156.031,229.56 152.282,228.098 161.063,224.402 		"/>
	</g>
</g>
<g>
	<path d="M154.523,211.832H154.5l-1.355,0.731l-0.204-0.803l1.703-0.912h0.899v7.796h-1.02V211.832z"/>
	<path d="M161.172,215.022v0.768h-2.963v-0.768H161.172z"/>
	<path d="M162.444,210.669c0.528-0.096,1.296-0.168,2.003-0.168c1.115,0,1.848,0.216,2.339,0.659
		c0.396,0.36,0.636,0.912,0.636,1.548c0,1.056-0.672,1.763-1.511,2.051v0.036c0.611,0.216,0.983,0.791,1.175,1.631
		c0.264,1.127,0.456,1.907,0.624,2.219h-1.079c-0.133-0.24-0.312-0.924-0.528-1.931c-0.239-1.115-0.684-1.535-1.631-1.571h-0.983
		v3.502h-1.044V210.669z M163.488,214.351h1.067c1.115,0,1.823-0.611,1.823-1.535c0-1.043-0.756-1.499-1.859-1.499
		c-0.504,0-0.852,0.036-1.031,0.084V214.351z"/>
</g>
<g>
	<g>
		<line fill="none" stroke="#010101" x1="113.941" y1="54.117" x2="113.941" y2="103.999"/>
		<polygon fill="#010101" points="110.238,101.19 113.941,102.763 117.646,101.19 113.941,109.968 		"/>
	</g>
</g>
<g>
	<g>
		<line fill="none" stroke="#010101" stroke-dasharray="3,3" x1="113.941" y1="126.059" x2="113.941" y2="175.94"/>
		<polygon fill="#010101" points="110.238,173.132 113.941,174.705 117.646,173.132 113.941,181.91 		"/>
	</g>
</g>
<g>
	<g>
		<line fill="none" stroke="#010101" stroke-dasharray="3,3" x1="68.316" y1="204.813" x2="68.316" y2="84.999"/>
		<polygon fill="#010101" points="72.019,87.808 68.316,86.235 64.612,87.808 68.316,79.03 		"/>
	</g>
</g>
<g>
	<g>
		<line fill="none" stroke="#010101" x1="121.498" y1="118.478" x2="181" y2="118.478"/>
		<polygon fill="#010101" points="178.191,122.181 179.764,118.478 178.191,114.773 186.969,118.478 		"/>
	</g>
</g>
<g>
	<path d="M65.86,30.999l-2.65-8.083h1.139l1.259,3.982c0.336,1.091,0.636,2.075,0.863,3.022h0.024
		c0.228-0.935,0.552-1.955,0.924-3.01l1.367-3.994h1.115l-2.891,8.083H65.86z"/>
	<path d="M71.519,31.025h-0.014l-0.79,0.427l-0.119-0.468l0.992-0.531h0.524v4.542h-0.594V31.025z"/>
</g>
<g>
	<path d="M65.86,65.794l-2.65-8.083h1.139l1.259,3.982c0.336,1.091,0.636,2.075,0.863,3.022h0.024
		c0.228-0.935,0.552-1.955,0.924-3.01l1.367-3.994h1.115l-2.891,8.083H65.86z"/>
	<path d="M70.184,69.79v-0.377l0.482-0.468c1.16-1.104,1.691-1.691,1.691-2.376c0-0.461-0.217-0.888-0.895-0.888
		c-0.413,0-0.755,0.21-0.965,0.384l-0.195-0.433c0.308-0.259,0.762-0.461,1.278-0.461c0.979,0,1.391,0.671,1.391,1.321
		c0,0.839-0.607,1.517-1.565,2.439l-0.356,0.335v0.014h2.034v0.51H70.184z"/>
</g>
<g>
	<path d="M111.485,198.999l-2.65-8.083h1.14l1.259,3.981c0.336,1.091,0.636,2.075,0.863,3.022h0.024
		c0.228-0.936,0.552-1.955,0.924-3.011l1.367-3.993h1.115l-2.891,8.083H111.485z"/>
	<path d="M115.956,202.297c0.175,0.104,0.573,0.279,1.007,0.279c0.782,0,1.034-0.496,1.027-0.881
		c-0.007-0.637-0.58-0.908-1.174-0.908h-0.343v-0.461h0.343c0.447,0,1.013-0.231,1.013-0.77c0-0.363-0.23-0.685-0.797-0.685
		c-0.363,0-0.713,0.161-0.908,0.3l-0.168-0.447c0.245-0.174,0.706-0.35,1.195-0.35c0.895,0,1.3,0.531,1.3,1.084
		c0,0.475-0.286,0.873-0.839,1.076v0.014c0.56,0.105,1.007,0.524,1.014,1.16c0,0.727-0.573,1.363-1.656,1.363
		c-0.51,0-0.957-0.161-1.181-0.308L115.956,202.297z"/>
</g>
<g>
	<path d="M111.485,239.999l-2.65-8.083h1.14l1.259,3.981c0.336,1.091,0.636,2.075,0.863,3.022h0.024
		c0.228-0.936,0.552-1.955,0.924-3.011l1.367-3.993h1.115l-2.891,8.083H111.485z"/>
	<path d="M117.711,243.995v-1.244H115.6v-0.397l2.027-2.9h0.664v2.822h0.636v0.476h-0.636v1.244H117.711z M117.711,242.275v-1.516
		c0-0.238,0.007-0.476,0.021-0.713h-0.021c-0.141,0.266-0.252,0.461-0.378,0.67l-1.111,1.545v0.014H117.711z"/>
</g>
<g>
	<path d="M55.958,115.618v2.818h2.71v0.72h-2.71v2.843H55.19v-2.843h-2.711v-0.72h2.711v-2.818H55.958z"/>
</g>
<g>
	<path d="M126.451,79.7c0,0.504,0.024,0.996,0.084,1.392h-0.947l-0.084-0.731h-0.036c-0.323,0.456-0.947,0.863-1.775,0.863
		c-1.175,0-1.774-0.827-1.774-1.667c0-1.403,1.247-2.171,3.49-2.159v-0.119c0-0.468-0.132-1.344-1.319-1.332
		c-0.552,0-1.115,0.156-1.523,0.432l-0.24-0.707c0.48-0.3,1.188-0.504,1.919-0.504c1.775,0,2.207,1.211,2.207,2.362V79.7z
		 M125.432,78.13c-1.151-0.024-2.458,0.18-2.458,1.307c0,0.696,0.455,1.008,0.983,1.008c0.768,0,1.259-0.479,1.427-0.972
		c0.036-0.12,0.048-0.24,0.048-0.336V78.13z"/>
</g>
<g>
	<path d="M152.569,105.439h1.043v3.646h0.024c0.371-0.647,1.043-1.056,1.979-1.056c1.451,0,2.459,1.199,2.459,2.95
		c0,2.075-1.319,3.106-2.615,3.106c-0.839,0-1.511-0.323-1.955-1.079h-0.023l-0.061,0.947h-0.899
		c0.024-0.396,0.049-0.983,0.049-1.499V105.439z M153.612,111.628c0,0.133,0.012,0.265,0.048,0.384
		c0.192,0.732,0.815,1.235,1.583,1.235c1.115,0,1.764-0.899,1.764-2.23c0-1.163-0.6-2.159-1.739-2.159
		c-0.708,0-1.38,0.504-1.596,1.296c-0.035,0.132-0.06,0.275-0.06,0.443V111.628z"/>
</g>
<g>
	<path d="M124.456,149.618v2.818h2.71v0.72h-2.71v2.843h-0.768v-2.843h-2.711v-0.72h2.711v-2.818H124.456z"/>
</g>
<g id="Q">
	<g>
		<path d="M116.498,51.04c-1.092-0.288-2.159-0.612-3.095-0.936c-0.18-0.06-0.335-0.12-0.491-0.12
			c-1.932-0.072-3.562-1.487-3.562-4.102c0-2.591,1.571-4.258,3.754-4.258c2.207,0,3.635,1.703,3.635,4.09
			c0,2.087-0.96,3.406-2.303,3.886v0.048c0.803,0.204,1.679,0.396,2.362,0.516L116.498,51.04z M115.635,45.774
			c0-1.631-0.84-3.298-2.555-3.298c-1.764,0-2.627,1.631-2.627,3.382c0,1.728,0.936,3.274,2.591,3.274
			S115.635,47.609,115.635,45.774z"/>
	</g>
	<ellipse id="Q_path1" fill="none" stroke="#010101" cx="112.603" cy="45.779" rx="9.471" ry="7.971"/>
</g>
<g id="P">
	<g>
		<path d="M111.66,115.012c0.504-0.084,1.164-0.156,2.004-0.156c1.031,0,1.787,0.24,2.268,0.672c0.432,0.384,0.707,0.972,0.707,1.69
			c0,0.732-0.217,1.308-0.625,1.728c-0.562,0.588-1.451,0.888-2.469,0.888c-0.312,0-0.602-0.013-0.84-0.072v3.238h-1.045V115.012z
			 M112.705,118.909c0.227,0.061,0.516,0.084,0.863,0.084c1.26,0,2.027-0.624,2.027-1.715c0-1.079-0.768-1.596-1.908-1.596
			c-0.455,0-0.803,0.036-0.982,0.084V118.909z"/>
	</g>
	<ellipse id="P_path1" fill="none" stroke="#010101" cx="112.051" cy="118.477" rx="9.471" ry="7.971"/>
</g>
<g id="R">
	<g>
		<path d="M65.999,210.669c0.528-0.096,1.296-0.168,2.003-0.168c1.115,0,1.848,0.216,2.339,0.66
			c0.396,0.359,0.636,0.911,0.636,1.547c0,1.056-0.672,1.763-1.511,2.051v0.036c0.611,0.216,0.983,0.791,1.175,1.631
			c0.264,1.127,0.456,1.907,0.624,2.219h-1.079c-0.133-0.24-0.312-0.924-0.528-1.931c-0.239-1.115-0.684-1.535-1.631-1.571h-0.983
			v3.502h-1.044V210.669z M67.043,214.351h1.067c1.115,0,1.823-0.611,1.823-1.535c0-1.043-0.756-1.499-1.859-1.499
			c-0.504,0-0.852,0.036-1.031,0.084V214.351z"/>
	</g>
	<ellipse id="R_path1" fill="none" stroke="#010101" cx="68.908" cy="215.122" rx="9.471" ry="7.971"/>
</g>
</svg>
</window>