/* * To change this template, choose Tools | Templates * and open the template in the editor. */ function IsItemSelected(check, target) { if (check.value) { target.disabled = false; } else { target.disabled = true; } } function IsCheckEnabled(check, target) { if (check.checked) { target.disabled = false; this.removeClass(target, "dis"); } else { target.disabled = true; this.addClass(target, "dis"); } } function SubmitToolbox() { document.forms['toolbox'].submit(); } // Class manipulation function hasClass(ele,cls) { if (ele.className) return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)')); } function addClass(ele,cls) { if (!this.hasClass(ele,cls)) ele.className += " "+cls; } function removeClass(ele,cls) { if (hasClass(ele,cls)) { var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)'); ele.className=ele.className.replace(reg,' '); } } //new scripts! //start here!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! function selectStep(uid) { var nodes = document.getElementById("seqContent").childNodes; for (var i = 0; i < nodes.length; i++) { //loop through childNodes. Skip first node (whitespace) //debugger; if (hasClass(nodes[i], "displayStep")) { //check if current childNode is a displayStep, not divider or text. if (nodes[i].id == uid) { addClass(nodes[i], "selected"); } else { removeClass(nodes[i], "selected"); } } } // Update selected step field with uid of currently selected step. var selectedStepField = document.getElementById("selectedStepField"); selectedStepField.value = uid; } /* * This function allows for simple use of AJAX requests. * Calling format: * * var c[] = "uid=123"; * var c[] = "name=tschipper"; * var u = "getResult.php"; * newAjaxRequest(c, u, function(xml) { * * }); * * It is of course also possible to refer to an external function instead of * defining function(xml){} in the call itself, as below: * * newAjaxRequest(c, u, externalFunction(xml)); */ function newAjaxRequest(c, u, cb) { var xml; var content = c; //an array of strings, in "key=value" format. // assign a compatible request format if (window.XMLHttpRequest) { //Not IE5, IE6 xml = new XMLHttpRequest(); } else { //IE5, IE6 xml = new ActiveXObject("Microsoft.XMLHTTP"); } // subscribe the callback function to a response event xml.onreadystatechange = function() { if (xml.readyState == 4 && xml.status == 200) { //alert("Received!"); cb(xml); } }; // initialize XMLRequest xml.open("POST", u, true); xml.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); var contentString = ""; //iterate through parameters passed in variable c if (typeof(content)=='object'&&(input instanceof Array)) { // parameters were passed as an array of key=value strings for (var i = 0; i < content.length; i++) { contentString += content[i]; if (i != (content.length - 1)) { contentString += "&"; } } } else { // single parameter or string already formatted by calling function contentString = content; } // finally send the formatted request //alert(contentString); xml.send(contentString); } /* * ajaxStepRequest gets the markup for displaying a step in the sequencer from returnStep.php * Using ajax principle allows for editing of pipeline without constantly refreshing the page. */ function ajaxStepRequest(UIDS) { var c = "uids="+UIDS; var u = "returnStep.php"; newAjaxRequest(c, u, function(result) { document.getElementById("seqContent").innerHTML = result.responseText; }); } function ajaxInfoRequest(id, el) { var uid = id; var c = "uid="+uid; var u = "getInfo.php"; newAjaxRequest(c, u, function(result) { el.innerHTML = result.responseText; }); } function drawSteps() { var content = document.getElementById("seqContent"); var pipeline = document.getElementById("pipelineStringField").value; pipeline = pipeline.replace(/,/g , ",divider,"); //regex search for commas, global (repeat), to represent them with visual dividers. ajaxStepRequest(pipeline); } function updatePipelineHidden (pipelineString) { }