mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 00:13:35 +01:00
adden js-code for select popup
This commit is contained in:
parent
121d9aaf05
commit
0eec9363ff
@ -108,7 +108,7 @@ class ui_resources
|
||||
$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']['options-filter']= array(''=>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;
|
||||
@ -307,22 +307,17 @@ class ui_resources
|
||||
*/
|
||||
function select($content='')
|
||||
{
|
||||
if($content['btn_close'])
|
||||
{
|
||||
echo "<html><body><script>window.close();</script></body></html>\n";
|
||||
$GLOBALS['egw']->common->egw_exit();
|
||||
}
|
||||
|
||||
if (isset($_GET['name'])) $name = $_GET['name'];
|
||||
$content=array('js_id' => $name);
|
||||
$content['js'] = "<script LANGUAGE=\"JavaScript\">
|
||||
$GLOBALS['egw_info']['flags']['java_script'] .= "<script LANGUAGE=\"JavaScript\">
|
||||
window.focus();
|
||||
|
||||
function addOption(id,label,value,multiple)
|
||||
{
|
||||
openerSelectBox = opener.document.getElementById(id);
|
||||
openerid='exec[resources][selectbox]';
|
||||
id='exec[nm][rows][selectbox]';
|
||||
|
||||
if (multiple && openerSelectBox) {
|
||||
function addOption(label,value)
|
||||
{
|
||||
openerSelectBox = opener.document.getElementById(openerid);
|
||||
|
||||
if (openerSelectBox) {
|
||||
select = '';
|
||||
for(i=0; i < openerSelectBox.length; i++) {
|
||||
with (openerSelectBox.options[i]) {
|
||||
@ -332,13 +327,10 @@ class ui_resources
|
||||
}
|
||||
}
|
||||
select += (select ? ',' : '')+value;
|
||||
opener.addOption(id,label,value,0);
|
||||
opener.addOption(id,'multiple*',select,0);
|
||||
opener.selectbox_add_option(openerid,label,value,0);
|
||||
opener.selectbox_add_option(openerid,'multiple*',select,0);
|
||||
}
|
||||
else {
|
||||
opener.addOption(id,label,value,!multiple && openerSelectBox && openerSelectBox.selectedIndex < 0);
|
||||
}
|
||||
selectBox = document.getElementById('uiaccountsel_popup_selection');
|
||||
selectBox = document.getElementById(id);
|
||||
if (selectBox) {
|
||||
for (i=0; i < selectBox.length; i++) {
|
||||
if (selectBox.options[i].value == value) {
|
||||
@ -352,11 +344,11 @@ class ui_resources
|
||||
}
|
||||
}
|
||||
|
||||
function removeSelectedOptions(id)
|
||||
function removeSelectedOptions()
|
||||
{
|
||||
openerSelectBox = opener.document.getElementById(id);
|
||||
openerSelectBox = opener.document.getElementById(openerid);
|
||||
if (openerSelectBox == null) window.close();
|
||||
selectBox = document.getElementById('uiaccountsel_popup_selection');
|
||||
selectBox = document.getElementById(id);
|
||||
for (i=0; i < selectBox.length; i++) {
|
||||
if (selectBox.options[i].selected) {
|
||||
for (j=0; j < openerSelectBox.length; j++) {
|
||||
@ -369,10 +361,10 @@ class ui_resources
|
||||
}
|
||||
}
|
||||
|
||||
function copyOptions(id)
|
||||
function copyOptions()
|
||||
{
|
||||
openerSelectBox = opener.document.getElementById(id);
|
||||
selectBox = document.getElementById('uiaccountsel_popup_selection');
|
||||
openerSelectBox = opener.document.getElementById(openerid);
|
||||
selectBox = document.getElementById(id);
|
||||
for (i=0; i < openerSelectBox.length; i++) {
|
||||
with (openerSelectBox.options[i]) {
|
||||
if (selected && value.slice(0,1) != ',') {
|
||||
@ -382,21 +374,21 @@ class ui_resources
|
||||
}
|
||||
}
|
||||
|
||||
function oneLineSubmit(id)
|
||||
function oneLineSubmit()
|
||||
{
|
||||
openerSelectBox = opener.document.getElementById(id);
|
||||
openerSelectBox = opener.document.getElementById(openerid);
|
||||
|
||||
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);
|
||||
opener.addOption(openerid,'multiple*',selected,1);
|
||||
}
|
||||
else {
|
||||
for (i=0; i < openerSelectBox.length; i++) {
|
||||
with (openerSelectBox.options[i]) {
|
||||
if (selected) {
|
||||
opener.addOption(id,text,value,1);
|
||||
opener.addOption(openerid,text,value,1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -406,20 +398,26 @@ class ui_resources
|
||||
window.close();
|
||||
}</script>";
|
||||
|
||||
if (!is_object($GLOBALS['phpgw']->js))
|
||||
{
|
||||
$GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript');
|
||||
}
|
||||
$GLOBALS['phpgw']->js->set_onload("copyOptions('exec[resources][selectbox]');");
|
||||
|
||||
$content['nm']['header_left'] = 'resources.resource_select.header';
|
||||
$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']['options-filter']= array(''=>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;
|
||||
$content['nm']['rows']['js_id'] = 1;
|
||||
|
||||
$sel_options = array();
|
||||
$no_button = array();
|
||||
$preserv = $content;
|
||||
$this->tmpl->read('resources.resource_select');
|
||||
$this->tmpl->exec('resources.ui_resources.select',$content,$sel_options,$no_button,$preserv,2);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user