mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-28 19:03:14 +01:00
Remove popup account selection option
This commit is contained in:
parent
c3f2fa4602
commit
b3611a8dfd
@ -26,7 +26,6 @@
|
||||
* - 'groupmembers' => Non admins can only select groupmembers (Server side - normal selectbox)
|
||||
* - 'selectbox' => Selectbox with all accounts and groups (Server side - normal selectbox)
|
||||
* - 'primary_group' => Selectbox with primary group and search
|
||||
* - 'popup' => No selectbox, just search. No popup, the search replaces the selectbox
|
||||
*
|
||||
* Only primary_group and popup need anything different from a normal selectbox
|
||||
*
|
||||
@ -77,14 +76,6 @@ var et2_selectAccount = et2_selectbox.extend(
|
||||
// Reference to object with dialog
|
||||
this.dialog = null;
|
||||
|
||||
// Popup does not work with tags
|
||||
var type = this.egw().preference('account_selection', 'common');
|
||||
if(type == 'popup' && _attrs.multiple)
|
||||
{
|
||||
_attrs.tags = false;
|
||||
_attrs.rows = Math.max(2,_attrs.rows);
|
||||
}
|
||||
|
||||
this._super.call(this, _parent, _attrs);
|
||||
|
||||
// Allow certain widgets inside this one
|
||||
@ -145,33 +136,6 @@ var et2_selectAccount = et2_selectbox.extend(
|
||||
|
||||
this.getSurroundings().insertDOMNode(button[0]);
|
||||
}
|
||||
else if (type == 'popup')
|
||||
{
|
||||
// Allow search 'inside' this widget
|
||||
this.supportedWidgetClasses = [et2_link_entry];
|
||||
|
||||
this._create_search();
|
||||
// Use empty label as blur
|
||||
if(this.options.empty_label) this.search_widget.set_blur(this.options.empty_label);
|
||||
|
||||
// Rework to go around / through the selectbox
|
||||
if(this.input)
|
||||
{
|
||||
this.getValue = function() {return this.value;};
|
||||
this.set_value = function(_value) {
|
||||
this.value = _value;
|
||||
this.search_widget.set_value(_value);
|
||||
};
|
||||
this.search_widget.search.change(this, function(event) {
|
||||
var value = event.data.search_widget.getValue();
|
||||
event.data.value = typeof value == 'object' && value ? value.id : value;
|
||||
event.data.input.trigger("change");
|
||||
return false;
|
||||
});
|
||||
}
|
||||
var div = jQuery(document.createElement("div")).append(this.search_widget.getDOMNode());
|
||||
this.setDOMNode(div[0]);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@ -238,58 +202,6 @@ var et2_selectAccount = et2_selectbox.extend(
|
||||
this.multiOptions.prev().find('ul')
|
||||
.append(button);
|
||||
}
|
||||
else if (type == 'popup')
|
||||
{
|
||||
// Allow search 'inside' this widget
|
||||
this.supportedWidgetClasses = [et2_link_entry];
|
||||
|
||||
/**
|
||||
* Popup takes the dialog and embeds it in place of the selectbox
|
||||
*/
|
||||
var dialog = this._open_multi_search();
|
||||
dialog.dialog("close");
|
||||
var div = jQuery(document.createElement("div")).append(this.dialog);
|
||||
this.setDOMNode(div[0]);
|
||||
|
||||
var select_col = jQuery('#selection_col',dialog).children();
|
||||
var selected = jQuery('#'+this.getInstanceManager().uniqueId + "_selected", select_col);
|
||||
|
||||
// Re-do to get it to work around/through the select box
|
||||
this.set_value = function(_value) {
|
||||
selected.empty();
|
||||
if(typeof _value == 'string')
|
||||
{
|
||||
_value = _value.split(',');
|
||||
}
|
||||
if(typeof _value == 'object')
|
||||
{
|
||||
for(var key in _value)
|
||||
{
|
||||
this._add_selected(selected, _value[key]);
|
||||
}
|
||||
}
|
||||
};
|
||||
var widget = this;
|
||||
this.getValue = function() {
|
||||
// Update widget with selected
|
||||
var ids = [];
|
||||
var data = {};
|
||||
jQuery('#'+this.getInstanceManager().uniqueId + '_selected li',select_col).each(function() {
|
||||
var id = $j(this).attr("data-id");
|
||||
// Add to list
|
||||
ids.push(id);
|
||||
|
||||
// Make sure option is there
|
||||
if(jQuery('input[data-id="'+id+'"]',widget.multiOptions).length == 0)
|
||||
{
|
||||
widget._appendMultiOption(id,jQuery('label',this).text());
|
||||
}
|
||||
});
|
||||
|
||||
this.set_multi_value(ids);
|
||||
return ids;
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -60,7 +60,6 @@ class uiaccountsel
|
||||
* The function respects the 'account_selection' general preference:
|
||||
* - 'selectbox' => Selectbox with all accounts and groups
|
||||
* - 'primary_group' => Selectbox with primary group and search
|
||||
* - 'popup' => Popup with search
|
||||
* - 'groupmembers' => Non admins can only select groupmembers
|
||||
* - 'none' => Non admins can NOT select any other user
|
||||
*
|
||||
@ -142,10 +141,6 @@ class uiaccountsel
|
||||
}
|
||||
switch($account_sel)
|
||||
{
|
||||
case 'popup':
|
||||
$select = $selected;
|
||||
break;
|
||||
|
||||
case 'primary_group':
|
||||
case 'groupmembers':
|
||||
if ($account_sel == 'primary_group')
|
||||
@ -250,7 +245,7 @@ class uiaccountsel
|
||||
'multiple' => $lines, // single selection (multiple=0), closes after the first selection
|
||||
),false);
|
||||
$app = $GLOBALS['egw_info']['flags']['currentapp'];
|
||||
if (!$only_groups && ($lines <= 1 && $this->account_selection == 'popup' || !$lines && $this->account_selection == 'primary_group'))
|
||||
if (!$only_groups && ($lines <= 1 && !$lines && $this->account_selection == 'primary_group'))
|
||||
{
|
||||
if (!$lines)
|
||||
{
|
||||
@ -279,7 +274,7 @@ class uiaccountsel
|
||||
$html = html::select($name,$selected,$select,True,$options.' id="'.$element_id.
|
||||
'" data-popup-link="'.htmlspecialchars($link).'"',$lines > 1 ? $lines : 0,false);
|
||||
|
||||
if (!$only_groups && ($lines > 0 && $this->account_selection == 'popup' || $lines > 1 && $this->account_selection == 'primary_group'))
|
||||
if (!$only_groups && $lines > 1 && $this->account_selection == 'primary_group')
|
||||
{
|
||||
$html .= html::submit_button('search','Search accounts',$js,false,
|
||||
' title="'.html::htmlspecialchars(lang('Search accounts')).
|
||||
|
@ -72,7 +72,6 @@ class preferences_hooks
|
||||
$account_sels = array(
|
||||
'selectbox' => lang('Selectbox'),
|
||||
'primary_group' => lang('Selectbox with primary group and search'),
|
||||
'popup' => lang('Popup with search'),
|
||||
'groupmembers' => lang('Selectbox with groupmembers'),
|
||||
'none' => lang('No user-selection at all'),
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user