diff --git a/resources/inc/class.ui_resources.inc.php b/resources/inc/class.ui_resources.inc.php index 8fdd7a2fab..a5e65c6b4b 100755 --- a/resources/inc/class.ui_resources.inc.php +++ b/resources/inc/class.ui_resources.inc.php @@ -304,101 +304,117 @@ class ui_resources * * @author Lukas Weiss */ - function select() + function select($content='') { + if($content['btn_close']) + { + echo "\n"; + $GLOBALS['egw']->common->egw_exit(); + } + if (isset($_GET['name'])) $name = $_GET['name']; $content=array('js_id' => $name); $content['js'] = ""; + + function removeSelectedOptions(id) + { + openerSelectBox = opener.document.getElementById(id); + if (openerSelectBox == null) window.close(); + selectBox = document.getElementById('uiaccountsel_popup_selection'); + for (i=0; i < selectBox.length; i++) { + if (selectBox.options[i].selected) { + for (j=0; j < openerSelectBox.length; j++) { + if (openerSelectBox[j].value == selectBox.options[i].value) { + openerSelectBox.removeChild(openerSelectBox[j]); + } + } + selectBox.options[i--] = null; + } + } + } + + function copyOptions(id) + { + openerSelectBox = opener.document.getElementById(id); + selectBox = document.getElementById('uiaccountsel_popup_selection'); + for (i=0; i < openerSelectBox.length; i++) { + with (openerSelectBox.options[i]) { + if (selected && value.slice(0,1) != ',') { + selectBox.options[selectBox.length] = new Option(text,value); + } + } + } + } + + function oneLineSubmit(id) + { + openerSelectBox = opener.document.getElementById(id); + + if (openerSelectBox) { + if (openerSelectBox.selectedIndex >= 0) { + selected = openerSelectBox.options[openerSelectBox.selectedIndex].value; + if (selected.slice(0,1) == ',') selected = selected.slice(1); + opener.addOption(id,'multiple*',selected,1); + } + else { + for (i=0; i < openerSelectBox.length; i++) { + with (openerSelectBox.options[i]) { + if (selected) { + opener.addOption(id,text,value,1); + break; + } + } + } + } + } + window.close(); + }"; + + $content['nm']['show_bookable'] = true; + $content['nm']['get_rows'] = 'resources.bo_resources.get_rows'; + $content['nm']['no_filter'] = False; + $content['nm']['filter_label'] = 'Category'; + $content['nm']['filter_help'] = lang('Select a category'); // is this used??? + $content['nm']['options-filter']= array('0'=>lang('all categories'))+(array)$this->bo->acl->get_cats(EGW_ACL_READ); + $content['nm']['no_filter2'] = true; + $content['nm']['filter_no_lang'] = true; + $content['nm']['no_cat'] = true; + $sel_options = array(); $no_button = array(); $preserv = $content;