Author: nathangray
New Revision: 54963
URL: http://svn.stylite.de/viewvc/egroupware?rev=54963&view=rev
Log:
Use taglist for owner
Added:
trunk/calendar/js/et2_widget_owner.js
Modified:
trunk/calendar/inc/class.calendar_ui.inc.php
trunk/calendar/inc/class.calendar_uiforms.inc.php
trunk/calendar/js/app.js
trunk/calendar/templates/default/sidebox.xet
trunk/calendar/templates/pixelegg/app.css
Modified: trunk/calendar/inc/class.calendar_ui.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/inc/class.calendar_ui.inc.php?rev=54963&r1=54962&r2=54963&view=diff
— trunk/calendar/inc/class.calendar_ui.inc.php (original)
+++ trunk/calendar/inc/class.calendar_ui.inc.php Tue Feb 9 21:28:57 2016
@@ -618,20 +618,45 @@
$content[‘date’] = $this->date ? $this->date : egw_time();
$owners = $this->owner ? is_array($this->owner) ? array($this->owner) : explode(’,’,$this->owner) : array($GLOBALS[‘egw_info’][‘user’][‘account_id’]);
-
$sel_options = array(); -
// Get user accounts, formatted nicely for grouping and matching -
// the ajax call calendar_uiforms->ajax_owner() -
$account_options = array('account_type' => 'both'); -
$accounts = accounts::link_query('',$account_options); -
$sel_options['owner'] = array_map( -
function($account_id, $account_name) { -
return array( -
'value' => $account_id, -
'label' => $account_name, -
'app' => lang('home-accounts') -
); -
}, -
array_keys($accounts), $accounts -
); // Add external owners that a select account widget will not find $linked_owners = array();
-
foreach($owners as $owner) -
{
-
foreach($owners as &$owner) -
{ -
$owner = ''.$owner; if(!is_numeric($owner)) { $resource = $this->bo->resources[substr($owner, 0,1)]; $label = egw_link::title($resource['app'], substr($owner,1)); $linked_owners[$resource['app']][substr($owner,1)] = $label;
-
$sel_options['owner'][] = array('value' => $owner, 'label' => $label); -
}
-
} -
else if (!in_array($owner, array_keys($accounts))) -
{ -
$label = egw_link::title('home-accounts',$owner); -
$resource = array('app'=> 'home-accounts'); -
} -
else -
{ -
continue; -
} -
$sel_options['owner'][] = array('value' => $owner, 'label' => $label, 'app' => lang($resource['app'])); } if($linked_owners) {
Modified: trunk/calendar/inc/class.calendar_uiforms.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/inc/class.calendar_uiforms.inc.php?rev=54963&r1=54962&r2=54963&view=diff
— trunk/calendar/inc/class.calendar_uiforms.inc.php (original)
+++ trunk/calendar/inc/class.calendar_uiforms.inc.php Tue Feb 9 21:28:57 2016
@@ -2942,6 +2942,59 @@
}
/**
-
- Handle ajax searches for owner across all supported resources
-
-
- @return Array List of matching results
- */
- public function ajax_owner()
- {
-
$query = $_REQUEST['query']; -
$options = ['num_rows' => 100]; -
$results = []; -
if($query) -
{ -
foreach($this->bo->resources as $type => $data) -
{ -
$mapped = array(); -
if ($data['app'] && egw_link::get_registry($data['app'], 'query')) -
{ -
$_results = egw_link::query($data['app'], $query,$options); -
if(!$_results) continue; -
$r_results = array_unique($_results); -
foreach($_results as $id => $title) -
{ -
if($id && $title) -
{ -
// Magicsuggest uses id, not value. -
$value = [ -
'id' => $type.$id, -
'value'=> $type.$id, -
'label' => $title, -
'app' => lang($data['app']) -
]; -
if(is_array($value['label'])) -
{ -
$value = array_merge($value, $value['label']); -
} -
$mapped[] = $value; -
} -
} -
if(count($mapped)) -
{ -
$results = array_merge($results, $mapped); -
} -
} -
} -
} -
// switch regular JSON response handling off -
egw_json_request::isJSONRequest(false); -
header('Content-Type: application/json; charset=utf-8'); -
echo json_encode($results); -
common::egw_exit(); - }
- /**
- imports a mail as Calendar
- @param array $mailContent = null mail content
Modified: trunk/calendar/js/app.js
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/js/app.js?rev=54963&r1=54962&r2=54963&view=diff
— trunk/calendar/js/app.js (original)
+++ trunk/calendar/js/app.js Tue Feb 9 21:28:57 2016
@@ -12,6 +12,7 @@
/*egw:uses
/etemplate/js/etemplate2.js;
- /calendar/js/et2_widget_owner.js;
/calendar/js/et2_widget_timegrid.js;
/calendar/js/et2_widget_planner.js;
*/
@@ -1972,13 +1973,6 @@
{
state.state.owner[state.state.owner.indexOf(‘0’)] = this.egw.user(‘account_id’);
}
-
if(state.state.owner.length === 1 && this.sidebox_et2) -
{ -
// If only one owner selected, go back to single select -
var owner = this.sidebox_et2.getWidgetById('owner'); -
owner.set_multiple(false); -
}
// Show the correct number of grids
var grid_count = 0;
@@ -2747,6 +2741,10 @@
}
if(!found)
{
-
if(!widget.options.select_options.push) -
{ -
widget.options.select_options = []; -
} widget.options.select_options.push(option); } }
@@ -2884,7 +2882,7 @@
for(var day in updated_days)
{
// Might be split by user, so we have to check that too
-
for(var i = 0; i < state.owner.length; i++)
-
for(var i = 0; i < typeof state.owner == 'object' ? state.owner.length : 1; i++) { var owner = multiple_owner ? state.owner[i] : state.owner; var cache_id = app.classes.calendar._daywise_cache_id(day, owner);
@@ -3247,6 +3245,14 @@
button.parent().css(‘margin-right’,button.outerWidth(true)+2);
button.parent().parent().css(‘white-space’,‘nowrap’);
}
-
$j(window).on('resize.calendar-owner', function() { -
var preferred_width = $j('#calendar-et2_target').children().first().outerWidth()||0; -
var owner = app.calendar.sidebox_et2.getWidgetById('owner'); -
if(preferred_width && owner.input.hasClass("chzn-done")) -
{ -
owner.input.next().css('width',preferred_width); -
} -
});},
/**
Added: trunk/calendar/js/et2_widget_owner.js
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/js/et2_widget_owner.js?rev=54963&view=auto
— trunk/calendar/js/et2_widget_owner.js (added)
+++ trunk/calendar/js/et2_widget_owner.js Tue Feb 9 21:28:57 2016
@@ -1,0 +1,59 @@
+/*
-
- Egroupware
-
- @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
-
- @package
-
- @subpackage
-
- @author Nathan Gray
-
- @version $Id$
- */
+“use strict”;
+
+/*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
-
- @augments et2_selectbox
- */
+var et2_calendar_owner = et2_taglist_email.extend(
+{ - attributes: {
-
"autocomplete_url": { -
"default": "calendar.calendar_uiforms.ajax_owner.etemplate" -
}, -
"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": {}, -
"description": "Internaly used to hold the select options." -
}, - },
- // Allows sub-widgets to override options to the library
- lib_options: {
-
groupBy: 'app', -
expandOnFocus: true - }
+});
+et2_register_widget(et2_calendar_owner, [“calendar_owner”]);
Modified: trunk/calendar/templates/default/sidebox.xet
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/templates/default/sidebox.xet?rev=54963&r1=54962&r2=54963&view=diff
— trunk/calendar/templates/default/sidebox.xet (original)
+++ trunk/calendar/templates/default/sidebox.xet Tue Feb 9 21:28:57 2016
@@ -27,7 +27,7 @@
-
<select-account id="owner" class="et2_fullWidth" onchange="app.calendar.update_state({owner: widget.getValue()});" expand_multiple_rows="4" account_type="both"/>
-
<calendar_owner id="owner" class="et2_fullWidth" onchange="app.calendar.update_state({owner: widget.getValue()}); return false;" multiple="true" allowFreeEntries="false"/> <!-- <taglist id="owner" class="et2_fullWidth" onchange="app.calendar.update_state({owner: widget.getValue()});" autocomplete_params=''/>
Modified: trunk/calendar/templates/pixelegg/app.css
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/templates/pixelegg/app.css?rev=54963&r1=54962&r2=54963&view=diff
— trunk/calendar/templates/pixelegg/app.css (original)
+++ trunk/calendar/templates/pixelegg/app.css Tue Feb 9 21:28:57 2016
@@ -11,7 +11,7 @@
- @package calendar
-
@version $Id$
/
-/ $Id: app.css 54928 2016-02-04 23:14:54Z nathangray $ /
+/ $Id: app.css 54941 2016-02-05 18:17:47Z nathangray $ */
/Media print classes/
@media print {
.th td,
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs