2016-03-01 17:27:45 +01:00
|
|
|
/*
|
2016-02-09 21:28:57 +01:00
|
|
|
* Egroupware
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
2016-03-01 17:27:45 +01:00
|
|
|
* @package
|
|
|
|
* @subpackage
|
2016-02-09 21:28:57 +01:00
|
|
|
* @link http://www.egroupware.org
|
|
|
|
* @author Nathan Gray
|
|
|
|
* @version $Id$
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*egw:uses
|
|
|
|
et2_widget_taglist;
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tag list widget customised for calendar owner, which can be a user
|
|
|
|
* account or group, or an entry from almost any app, or an email address
|
|
|
|
*
|
|
|
|
* A cross between auto complete, selectbox and chosen multiselect
|
|
|
|
*
|
|
|
|
* Uses MagicSuggest library
|
|
|
|
* @see http://nicolasbize.github.io/magicsuggest/
|
|
|
|
* @augments et2_selectbox
|
|
|
|
*/
|
2016-03-01 17:27:45 +01:00
|
|
|
var et2_calendar_owner = (function(){ "use strict"; return et2_taglist_email.extend(
|
2016-02-09 21:28:57 +01:00
|
|
|
{
|
|
|
|
attributes: {
|
|
|
|
"autocomplete_url": {
|
2016-02-18 20:45:37 +01:00
|
|
|
"default": "calendar_owner_etemplate_widget::ajax_owner"
|
2016-02-09 21:28:57 +01:00
|
|
|
},
|
|
|
|
"autocomplete_params": {
|
|
|
|
"name": "Autocomplete parameters",
|
|
|
|
"type": "any",
|
|
|
|
"default": {},
|
|
|
|
"description": "Extra parameters passed to autocomplete URL. It should be a stringified JSON object."
|
|
|
|
},
|
|
|
|
allowFreeEntries: {
|
|
|
|
"default": false,
|
|
|
|
ignore: true
|
|
|
|
},
|
|
|
|
select_options: {
|
|
|
|
"type": "any",
|
|
|
|
"name": "Select options",
|
|
|
|
// Set to empty object to use selectbox's option finding
|
|
|
|
"default": {},
|
2016-02-11 18:02:06 +01:00
|
|
|
"description": "Internally used to hold the select options."
|
2016-03-01 17:27:45 +01:00
|
|
|
}
|
2016-02-09 21:28:57 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
// Allows sub-widgets to override options to the library
|
|
|
|
lib_options: {
|
2016-02-16 22:37:19 +01:00
|
|
|
autoSelect: false,
|
2016-02-09 21:28:57 +01:00
|
|
|
groupBy: 'app',
|
2016-02-11 21:30:55 +01:00
|
|
|
minChars: 2,
|
2016-02-16 22:37:19 +01:00
|
|
|
selectFirst: true,
|
2016-02-11 21:30:55 +01:00
|
|
|
// This option will also expand when the selection is changed
|
|
|
|
// via code, which we do not want
|
|
|
|
//expandOnFocus: true
|
|
|
|
toggleOnClick: true
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
doLoadingFinished: function() {
|
|
|
|
this._super.apply(this, arguments);
|
|
|
|
|
|
|
|
var widget = this;
|
|
|
|
// onChange fired when losing focus, which is different from normal
|
|
|
|
this._oldValue = this.taglist.getValue();
|
2016-02-16 22:37:19 +01:00
|
|
|
this.$taglist
|
2016-03-10 18:56:44 +01:00
|
|
|
.on('focus', function() {widget.taglist.expand();});
|
2016-03-01 17:27:45 +01:00
|
|
|
|
|
|
|
|
2016-02-11 21:30:55 +01:00
|
|
|
return true;
|
|
|
|
},
|
|
|
|
|
|
|
|
getValue: function()
|
|
|
|
{
|
|
|
|
if(this.taglist == null) return null;
|
|
|
|
return this.taglist.getValue();
|
2016-02-09 21:28:57 +01:00
|
|
|
}
|
2016-03-01 17:27:45 +01:00
|
|
|
});}).call(this);
|
2016-02-18 20:45:37 +01:00
|
|
|
et2_register_widget(et2_calendar_owner, ["calendar-owner"]);
|