generatortable
by Wolfgang Fahl
HTML
<table id='generatortable'>
<thead id='tablehead'><tr id='headerrecord'><th><button onclick='return rungenerator();'><img src='https://cdn0.iconfinder.com/data/icons/ie_Glossy_button/48/button_16.png'/></button></th></tr></thead>
<tbody id='tablebody'></tbody>
</table>
<div id='result'>
</div>
JavaScript
function rungenerator() {
var list="";
var delim="";
$(".checkBoxClass:checked").each(
function( index, value ) {
id=this.id;
var generator=generators[id];
console.log(generator);
list=list+delim+id;
delim=", ";
});
console.log(list);
$("#result").html(list);
return false;
}
// add a TextElement with the given tag and message to the given parent
function newTextElement(tag, msg) {
var newElement = document.createElement(tag);
var content = document.createTextNode(msg);
newElement.appendChild(content);
return newElement;
}
// add an image to the given parent
function addImage(pParent, pSrc, pAlt, pTitle) {
var lbreak = document.createElement('br');
pParent.appendChild(lbreak);
var newImage = document.createElement('img');
newImage.src = pSrc;
newImage.alt = pAlt;
newImage.title = pTitle;
pParent.appendChild(newImage);
return newImage;
}
// create a new generator with the given id, y-technical and topic
function Generator(id, yt, topic) {
this.id = id;
this.yt = yt;
this.topic = topic;
return( this );
}
// jquery startup
$(document).ready(function () {
var topics = {
'Person': {
topic: "Person",
icon: "https://cdn1.iconfinder.com/data/icons/IconsLandVistaPeopleIconsDemo/48/Person_Undefined_Female_Light.png"
},
'Patient': {
topic: "Patient",
icon: "https://cdn3.iconfinder.com/data/icons/medical-a-symbol/164/9-48.png"
}
}
var yts = {
'Form': {
name: "Form",
label: "Form",
icon: "http://www.iconshock.com/img_jpg/PLASTICXP/networking/jpg/48/form_icon.jpg",
template: "SiDIFTemplates#form"
},
'Template': {
name: "Template",
label: "Template",
icon: "http://www.clarkemarketing.co.uk/images/icons/icon_template.png",
template:...