// $Id$ /////////////////////////////////////////////////////////////////////////// // // // NOTICE OF COPYRIGHT // // // // Moodle - Modular Object-Oriented Dynamic Learning Environment // // http://moodle.org // // // // Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com // // (C) 2001-3001 Eloy Lafuente (stronk7) http://contiento.com // // // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // // the Free Software Foundation; either version 2 of the License, or // // (at your option) any later version. // // // // This program is distributed in the hope that it will be useful, // // but WITHOUT ANY WARRANTY; without even the implied warranty of // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // GNU General Public License for more details: // // // // http://www.gnu.org/copyleft/gpl.html // // // /////////////////////////////////////////////////////////////////////////// /// Javascript used to handle AJAX forum ratings /** * This function initializes all the stuff needed to have forum ratings * working under AJAX. Basically it adds one onload listener that triggers * the add_menu_listeners() function to add menu listeners */ function init_rate_ajax () { YAHOO.util.Event.onDOMReady(add_menu_listeners); } /** * This function adds event listeners to any rating * menu found in he page (class = forumpostratingmenu) * and prevents manual submission */ function add_menu_listeners(e) { /** hide the submit button */ var submitbutton = YAHOO.util.Dom.get('forumpostratingsubmit'); submitbutton.style.display = 'none'; /** prevent form submission **/ var form = YAHOO.util.Dom.get('form'); YAHOO.util.Event.addListener(form, 'submit', prevent_form_submission); /** add listeners to all rating menus */ var menus = YAHOO.util.Dom.getElementsByClassName('forumpostratingmenu', 'select'); for (var i=0; i