All Downloads are FREE. Search and download functionalities are using the official Maven repository.

webapp.requests.js Maven / Gradle / Ivy

There is a newer version: 1.5.1
Show newest version

function init(){
	$('#new_request').on('submit', function(e){
		e.preventDefault();
		addNewRequest();
	});
	$('#submit_request').on('submit', function(e){
		e.preventDefault();
		addNewRequest();
	});
	// load form script first, then the form html, initialize form afterwards
	loadTemplateTypes();
	loadRequestList();
	// load nodes
	getNodes(function(nodes){
		for( var i=0; i",{
	        	value: nodes[i].id,
	        	text: nodes[i].cn,
	        	title: nodes[i].dn
	        }));
		}
		console.log('Loaded nodes: '+nodes.length);
	},function(){
		alert('DWH-Knoten konnten nicht geladen werden.');
	});
	$('#limit_target_a').click(function(){
		// clear selection
		$("#target option:selected").prop("selected", false);
		$("#target").prop("disabled", true);
	});
	$('#limit_target_a').prop("checked", true).trigger("click");
	$('#limit_target_s').click(function(){
		$("#target").prop("disabled", false);
	});
	// hide new request form
	$('#choose_template button').click(function(e){
		e.preventDefault();
		var tt = $('#template_type').val();
		$(this).parent().remove();
		$.getScript('template/'+tt+'/script.js', function(){
			$('#new_request').load('template/'+tt+'/form.html', function(){
				initializeForm();
				$('#create').show();
			});
		});

	});
	$('#create').hide();
	
}

//$(document).ready(function(){
//	init();
//});
Date.prototype.toDateInputValue = (function(){
	var local = new Date(this);//.toISOString();
	return local.toJSON().slice(0,10);
	//return local
});

function loadTemplateTypes(){
	$.getJSON(rest_base+'/template', function(data){
		console.log("Template",data);
		for( key in data ){
				$('#template_type').append($('




© 2015 - 2024 Weber Informatics LLC | Privacy Policy