Login   Register  
PHP Classes
elePHPant
Icontem

File: scripts/phritz.js

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Michael Collado  >  Phritz MVC framework  >  scripts/phritz.js  >  Download  
File: scripts/phritz.js
Role: Auxiliary data
Content type: text/plain
Description: Javascript used in example module
Class: Phritz MVC framework
Browser device independent MVC framework
Author: By
Last change:
Date: 7 years ago
Size: 1,967 bytes
 

Contents

Class file image Download
function loadProcedure(url, method, id, type) {
	if (type == 'soap') {
		var params = new SOAPClientParameters();
		params.add(id, document.getElementById(id).value);
		SOAPClient.invoke(url, method, params, true, null);
	} else {
		var msg = new XMLRPCMessage(method);
		msg.addParameter(document.getElementById(id).value);
		document.getElementById('request_cell').innerHTML = msg.xml().replace(/</g,'&lt;').replace(/>/g,'&gt;');
		var xmlHttp = SOAPClient._getXmlHttp();
		xmlHttp.open("POST", url, true);
		xmlHttp.setRequestHeader("Content-Type", "text/xml; charset=iso-8859-1");
		xmlHttp.onreadystatechange = function() {
						if (xmlHttp.readyState == 4) {
							document.getElementById('response_cell').innerHTML = "<pre>"+xmlHttp.responseText.replace(/</g,'&lt;').replace(/>/g,'&gt;')+"</pre>";
						}
					};
		xmlHttp.send(msg.xml());
	}
}

function loadAjax(url, params, om) {
	dojo.io.bind({url: url+'?'+om+'=true',
				handle: function (type, data, evt) {
							var pre = document.createElement('pre');
							document.getElementById('response_cell').innerHTML = "<pre>"+data.replace(/</g,'&lt;').replace(/>/g,'&gt;')+"</pre>";
						},
				content: params,
				mimetype: 'text/html'});
}

var wsdl_loaded = false;

function loadModule() {
	var mod = document.getElementById('modulename');
	var output = document.getElementById('outputmethod');
	var url = mod.value;
	if (!wsdl_loaded) {
		dojo.io.bind({url: url+'?wsdl', mimetype: 'text/html', 
					 	handle: function (type, data, evt) { 
							document.getElementById('wsdl').innerHTML = '<pre>'+data.replace(/</g,'&lt;').replace(/>/g,'&gt;')+'</pre>';
							wsdl_loaded = true;
						}});
	}
	ind = output.selectedIndex;
	var om = output.options[ind].value;
	if (om == 'soap' || om == 'rpc') {
		loadProcedure(url, 'TestResponse', 'firstname', om);
	} else {
		loadAjax(url, {firstname: document.getElementById('firstname').value}, om);
	}
}