var initReportForm = function(){ var select = document.getElementById('select_report'); select.addEventListener('change', onFormSelect); document.observe("dom:loaded", function() { var event = new Event('change'); select.dispatchEvent(event); }); }; var onFormSelect = function(){ //get form id var formid = this.options[this.selectedIndex].getAttribute('form'); //hide other forms $$('table.ep_search_fields').each(function (elem) { //hide the form $(elem).hide(); $(elem).select('input').each(function (input) { $(input).setAttribute("disabled", "disabled"); }); }); //show the form we want $(formid).show(); //enable this form's input elements $(formid).select('input').each(function (input) { $(input).removeAttribute("disabled"); }); }; // Used by the Screen::Report::render method var EPrints_Screen_Report_Loader = Class.create({ has_problems: 0, count: 0, runs: 0, progress: null, ids: Array(), step: 20, prefix: '', onProblems: function() {}, onFinish: function() {}, url: "", parameters: "", container: null, // to show a pretty progress bar (% compliance): total_dataobjs: 0, total_noncompliant: 0, initialize: function(opts) { if( opts.ids ) this.ids = opts.ids; if( opts.step ) this.step = opts.step; if( opts.prefix ) this.prefix = opts.prefix; if( opts.onFinish ) this.onFinish = opts.onFinish; if( opts.onProblems ) this.onProblems = opts.onProblems; if( opts.url ) this.url = opts.url; if( opts.parameters ) this.parameters = opts.parameters; if( opts.container_id ) this.container = $( opts.container_id ); // should fail if container doesn't exist... }, execute: function() { // progress-bar this.container.insert( new Element( 'div', { 'class': 'ep_report_progress_bar', 'id': this.prefix + "_progress_bar" } ) ); var current_grouping = null; // might not be set in the returned value but that's allowed/OK var dataobjs = {}; for(var i = 0; i < this.ids.length; i+=this.step) { // arguments for Ajax query AND creates the HTML placeholders