mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-27 21:32:46 +02:00
- Fix read-only multi-select, was not displaying
- Fix issue with 'rows' being separate, threw off other options - Move around icon/color multi-select options, use them for users. We'll see.
This commit is contained in:
parent
4684f25530
commit
f716f7fd6b
@ -121,7 +121,9 @@ class etemplate_widget_menupopup extends etemplate_widget
|
|||||||
if ($this->attrs['type'])
|
if ($this->attrs['type'])
|
||||||
{
|
{
|
||||||
// += to keep further options set by app code
|
// += to keep further options set by app code
|
||||||
self::$request->sel_options[$form_name] += self::typeOptions($this->attrs['type'], $this->attrs['options'],
|
self::$request->sel_options[$form_name] += self::typeOptions($this->attrs['type'],
|
||||||
|
// typeOptions thinks # of rows is the first thing in options
|
||||||
|
($this->attrs['rows'] && strpos($this->attrs['options'], $this->attrs['rows']) !== 0 ? $this->attrs['rows'].','.$this->attrs['options'] : $this->attrs['options']),
|
||||||
$no_lang, $this->attrs['readonly'], self::get_array(self::$request->content, $form_name));
|
$no_lang, $this->attrs['readonly'], self::get_array(self::$request->content, $form_name));
|
||||||
|
|
||||||
// if no_lang was modified, forward modification to the client
|
// if no_lang was modified, forward modification to the client
|
||||||
@ -293,14 +295,14 @@ class etemplate_widget_menupopup extends etemplate_widget
|
|||||||
}
|
}
|
||||||
$s .= $global_marker;
|
$s .= $global_marker;
|
||||||
}
|
}
|
||||||
$options[$cat['id']] = empty($cat['description']) ? $s : array(
|
$options[$cat['id']] = array(
|
||||||
'label' => $s,
|
'label' => $s,
|
||||||
'title' => $cat['description'],
|
'title' => empty($cat['description']) ? $s : $cat['description'],
|
||||||
);
|
);
|
||||||
// For multi-select, send data too
|
// For multi-select, send data too
|
||||||
if($rows > 1)
|
if($rows > 1)
|
||||||
{
|
{
|
||||||
$options[$cat['id']]['data'] = $cat['data'];
|
$options[$cat['id']] += $cat['data'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// preserv unavailible cats (eg. private user-cats)
|
// preserv unavailible cats (eg. private user-cats)
|
||||||
@ -590,7 +592,6 @@ class etemplate_widget_menupopup extends etemplate_widget
|
|||||||
$acc['account_'.$name] = $data[$id][$name];
|
$acc['account_'.$name] = $data[$id][$name];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$info = $show_type ? '('.$acc['account_type'].') ' : '';
|
|
||||||
|
|
||||||
if ($acc['account_type'] == 'g')
|
if ($acc['account_type'] == 'g')
|
||||||
{
|
{
|
||||||
@ -613,6 +614,12 @@ class etemplate_widget_menupopup extends etemplate_widget
|
|||||||
$acc['account_firstname'],$acc['account_lastname']);
|
$acc['account_firstname'],$acc['account_lastname']);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if($show_type) {
|
||||||
|
$info = array(
|
||||||
|
'label' => $info,
|
||||||
|
'icon' => $acc['account_type'] == 'g' ? 'addressbook/group' : 'users'
|
||||||
|
);
|
||||||
|
}
|
||||||
return $info;
|
return $info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -222,16 +222,16 @@ var et2_selectbox = et2_inputWidget.extend({
|
|||||||
// Some special stuff for categories
|
// Some special stuff for categories
|
||||||
if(option_data )
|
if(option_data )
|
||||||
{
|
{
|
||||||
if(option_data.data.icon)
|
if(option_data.icon)
|
||||||
{
|
{
|
||||||
var img = this.egw().image(option_data.data.icon);
|
var img = this.egw().image(option_data.icon);
|
||||||
jQuery(document.createElement("img"))
|
jQuery(document.createElement("img"))
|
||||||
.attr("src", img)
|
.attr("src", img)
|
||||||
.appendTo(label);
|
.appendTo(label);
|
||||||
}
|
}
|
||||||
if(option_data.data.color)
|
if(option_data.color)
|
||||||
{
|
{
|
||||||
label.css("background-color",option_data.data.color);
|
label.css("background-color",option_data.color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
label.append(jQuery("<span>"+_label+"</span>"))
|
label.append(jQuery("<span>"+_label+"</span>"))
|
||||||
@ -519,7 +519,10 @@ var et2_selectbox_ro = et2_selectbox.extend([et2_IDetachedDOM], {
|
|||||||
|
|
||||||
// Handle read-only multiselects in the same way
|
// Handle read-only multiselects in the same way
|
||||||
createMultiSelect: function() {
|
createMultiSelect: function() {
|
||||||
this.createInputWidget();
|
this.span = $j(document.createElement("ul"))
|
||||||
|
.addClass("et2_selectbox readonly");
|
||||||
|
|
||||||
|
this.setDOMNode(this.span[0]);
|
||||||
},
|
},
|
||||||
|
|
||||||
loadFromXML: function(_node) {
|
loadFromXML: function(_node) {
|
||||||
@ -543,7 +546,25 @@ var et2_selectbox_ro = et2_selectbox.extend([et2_IDetachedDOM], {
|
|||||||
},
|
},
|
||||||
|
|
||||||
set_value: function(_value) {
|
set_value: function(_value) {
|
||||||
|
if(typeof _value == "string" && _value.match(/[,0-9]+$/) !== null && this.options.multiple)
|
||||||
|
{
|
||||||
|
_value = _value.split(',');
|
||||||
|
}
|
||||||
this.value = _value;
|
this.value = _value;
|
||||||
|
if(typeof _value == "object")
|
||||||
|
{
|
||||||
|
this.span.empty();
|
||||||
|
for(var i = 0; i < _value.length; i++)
|
||||||
|
{
|
||||||
|
var option = this.optionValues[_value[i]];
|
||||||
|
if(typeof option === "object")
|
||||||
|
{
|
||||||
|
option = option.label;
|
||||||
|
}
|
||||||
|
this.span.append("<li>"+option+"</li>");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
var option = this.optionValues[_value];
|
var option = this.optionValues[_value];
|
||||||
if (typeof option === 'object')
|
if (typeof option === 'object')
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user