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']['no_filter'] = False;
|
||||||
$content['nm']['filter_label'] = 'Category';
|
$content['nm']['filter_label'] = 'Category';
|
||||||
$content['nm']['filter_help'] = lang('Select a category'); // is this used???
|
$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']['no_filter2'] = true;
|
||||||
$content['nm']['filter_no_lang'] = true;
|
$content['nm']['filter_no_lang'] = true;
|
||||||
$content['nm']['no_cat'] = true;
|
$content['nm']['no_cat'] = true;
|
||||||
@ -307,22 +307,17 @@ class ui_resources
|
|||||||
*/
|
*/
|
||||||
function select($content='')
|
function select($content='')
|
||||||
{
|
{
|
||||||
if($content['btn_close'])
|
$GLOBALS['egw_info']['flags']['java_script'] .= "<script LANGUAGE=\"JavaScript\">
|
||||||
{
|
|
||||||
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\">
|
|
||||||
window.focus();
|
window.focus();
|
||||||
|
|
||||||
|
openerid='exec[resources][selectbox]';
|
||||||
|
id='exec[nm][rows][selectbox]';
|
||||||
|
|
||||||
function addOption(id,label,value,multiple)
|
function addOption(label,value)
|
||||||
{
|
{
|
||||||
openerSelectBox = opener.document.getElementById(id);
|
openerSelectBox = opener.document.getElementById(openerid);
|
||||||
|
|
||||||
if (multiple && openerSelectBox) {
|
if (openerSelectBox) {
|
||||||
select = '';
|
select = '';
|
||||||
for(i=0; i < openerSelectBox.length; i++) {
|
for(i=0; i < openerSelectBox.length; i++) {
|
||||||
with (openerSelectBox.options[i]) {
|
with (openerSelectBox.options[i]) {
|
||||||
@ -332,13 +327,10 @@ class ui_resources
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
select += (select ? ',' : '')+value;
|
select += (select ? ',' : '')+value;
|
||||||
opener.addOption(id,label,value,0);
|
opener.selectbox_add_option(openerid,label,value,0);
|
||||||
opener.addOption(id,'multiple*',select,0);
|
opener.selectbox_add_option(openerid,'multiple*',select,0);
|
||||||
}
|
}
|
||||||
else {
|
selectBox = document.getElementById(id);
|
||||||
opener.addOption(id,label,value,!multiple && openerSelectBox && openerSelectBox.selectedIndex < 0);
|
|
||||||
}
|
|
||||||
selectBox = document.getElementById('uiaccountsel_popup_selection');
|
|
||||||
if (selectBox) {
|
if (selectBox) {
|
||||||
for (i=0; i < selectBox.length; i++) {
|
for (i=0; i < selectBox.length; i++) {
|
||||||
if (selectBox.options[i].value == value) {
|
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();
|
if (openerSelectBox == null) window.close();
|
||||||
selectBox = document.getElementById('uiaccountsel_popup_selection');
|
selectBox = document.getElementById(id);
|
||||||
for (i=0; i < selectBox.length; i++) {
|
for (i=0; i < selectBox.length; i++) {
|
||||||
if (selectBox.options[i].selected) {
|
if (selectBox.options[i].selected) {
|
||||||
for (j=0; j < openerSelectBox.length; j++) {
|
for (j=0; j < openerSelectBox.length; j++) {
|
||||||
@ -369,10 +361,10 @@ class ui_resources
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyOptions(id)
|
function copyOptions()
|
||||||
{
|
{
|
||||||
openerSelectBox = opener.document.getElementById(id);
|
openerSelectBox = opener.document.getElementById(openerid);
|
||||||
selectBox = document.getElementById('uiaccountsel_popup_selection');
|
selectBox = document.getElementById(id);
|
||||||
for (i=0; i < openerSelectBox.length; i++) {
|
for (i=0; i < openerSelectBox.length; i++) {
|
||||||
with (openerSelectBox.options[i]) {
|
with (openerSelectBox.options[i]) {
|
||||||
if (selected && value.slice(0,1) != ',') {
|
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) {
|
||||||
if (openerSelectBox.selectedIndex >= 0) {
|
if (openerSelectBox.selectedIndex >= 0) {
|
||||||
selected = openerSelectBox.options[openerSelectBox.selectedIndex].value;
|
selected = openerSelectBox.options[openerSelectBox.selectedIndex].value;
|
||||||
if (selected.slice(0,1) == ',') selected = selected.slice(1);
|
if (selected.slice(0,1) == ',') selected = selected.slice(1);
|
||||||
opener.addOption(id,'multiple*',selected,1);
|
opener.addOption(openerid,'multiple*',selected,1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (i=0; i < openerSelectBox.length; i++) {
|
for (i=0; i < openerSelectBox.length; i++) {
|
||||||
with (openerSelectBox.options[i]) {
|
with (openerSelectBox.options[i]) {
|
||||||
if (selected) {
|
if (selected) {
|
||||||
opener.addOption(id,text,value,1);
|
opener.addOption(openerid,text,value,1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -405,6 +397,12 @@ class ui_resources
|
|||||||
}
|
}
|
||||||
window.close();
|
window.close();
|
||||||
}</script>";
|
}</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']['header_left'] = 'resources.resource_select.header';
|
||||||
$content['nm']['show_bookable'] = true;
|
$content['nm']['show_bookable'] = true;
|
||||||
@ -412,14 +410,14 @@ class ui_resources
|
|||||||
$content['nm']['no_filter'] = False;
|
$content['nm']['no_filter'] = False;
|
||||||
$content['nm']['filter_label'] = 'Category';
|
$content['nm']['filter_label'] = 'Category';
|
||||||
$content['nm']['filter_help'] = lang('Select a category'); // is this used???
|
$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']['no_filter2'] = true;
|
||||||
$content['nm']['filter_no_lang'] = true;
|
$content['nm']['filter_no_lang'] = true;
|
||||||
$content['nm']['no_cat'] = true;
|
$content['nm']['no_cat'] = true;
|
||||||
|
$content['nm']['rows']['js_id'] = 1;
|
||||||
|
|
||||||
$sel_options = array();
|
$sel_options = array();
|
||||||
$no_button = array();
|
$no_button = array();
|
||||||
$preserv = $content;
|
|
||||||
$this->tmpl->read('resources.resource_select');
|
$this->tmpl->read('resources.resource_select');
|
||||||
$this->tmpl->exec('resources.ui_resources.select',$content,$sel_options,$no_button,$preserv,2);
|
$this->tmpl->exec('resources.ui_resources.select',$content,$sel_options,$no_button,$preserv,2);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user