/***************************************** * * $Id$ * * File : $RCSfile: group_association.js,v $ * Project : Contenido * Descr : File contains java script functions for filtering users in select areas, handling short keys and submitting form * This functions are used in template template.grouprights_memberselect.html * * Author : $Author: timo.trautmann$ * Modified : $Date$ * * © four for business AG, www.4fb.de ******************************************/ var keycode = 0; //last pressed key var addAction = ''; //contenidoaction for adding user to group - (different fpr frontentgroups and backendgroups) var deleteAction = ''; //contenidoaction for removing user from group - (different fpr frontentgroups and backendgroups) /** * Initialization of previous defined variables * * @param string add - adding user contenido action * @param string del - removing user contenido action * */ function init(add, del) { addAction = add; deleteAction = del; } /** * Function submits form when users were added to group or removed from group * * @param string isAdded - contenido action string * */ function setAction(isAdded) { var selectId = null; //case of adding new members if (isAdded == addAction) { selectId = 'newmember'; document.group_properties.action.value = addAction; //case of removing existing members } else { selectId = 'user_in_group'; document.group_properties.action.value = deleteAction; } var sSelectBox = document.getElementById(selectId); //only submit form, if a user is selected if (sSelectBox.selectedIndex != -1) { document.group_properties.submit(); } } /** * Function filters entries in select box and shows only relevant users for selection * * @param string id - id of textbox, which contains the search string * */ function filter (id) { //get search string ans buid regular expression var sFilterValue = document.getElementById(id).value; var oReg = new RegExp(sFilterValue,"gi"); //build id of corresponding select box var sSelectId = id.replace(/_filter_value/, ''); //get select box and corresponding options var sSelectBox = document.getElementById(sSelectId); var oOptions = sSelectBox.getElementsByTagName('option'); //remove all options var iLen = oOptions.length; for (var i=0; i