mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 00:29:38 +01:00
Fix insert into document from sidebox dropdown
This commit is contained in:
parent
7ccbdfe871
commit
cdc3ad9a10
@ -267,7 +267,6 @@ class calendar_ui
|
||||
// retrieve saved states from prefs
|
||||
if(!$states)
|
||||
{
|
||||
error_log('HERE');
|
||||
$states = unserialize($this->bo->cal_prefs['saved_states']);
|
||||
error_log(array2string($states));
|
||||
}
|
||||
@ -605,6 +604,8 @@ class calendar_ui
|
||||
$menu_title = lang('Calendar Menu');
|
||||
display_sidebox($appname,$menu_title,$file);
|
||||
|
||||
$this->sidebox_etemplate();
|
||||
|
||||
// resources menu hooks
|
||||
foreach ($this->bo->resources as $resource)
|
||||
{
|
||||
@ -636,6 +637,16 @@ class calendar_ui
|
||||
{
|
||||
if($content['merge'])
|
||||
{
|
||||
// View from sidebox is JSON encoded
|
||||
$this->manage_states(array_merge($content,json_decode($content['view'],true)));
|
||||
if($content['first'])
|
||||
{
|
||||
$this->first = egw_time::to($content['first'],'ts');
|
||||
}
|
||||
if($content['last'])
|
||||
{
|
||||
$this->last = egw_time::to($content['last'],'ts');
|
||||
}
|
||||
$_GET['merge'] = $content['merge'];
|
||||
$this->merge();
|
||||
return;
|
||||
|
@ -218,17 +218,20 @@ class calendar_uiviews extends calendar_ui
|
||||
// handle views in other files
|
||||
if (!isset($this->public_functions[$this->view]) && $this->view !== 'listview')
|
||||
{
|
||||
$GLOBALS['egw']->redirect_link('/index.php',array('menuaction'=>$this->view_menuaction,'ajax'=>'true'),'calendar');
|
||||
$this->view = 'week';
|
||||
}
|
||||
// get manual to load the right page
|
||||
$GLOBALS['egw_info']['flags']['params']['manual'] = array('page' => 'ManualCalendar'.ucfirst($this->view));
|
||||
|
||||
// Sidebox & iframe for old views
|
||||
if(in_array($this->view,array('year','planner')))
|
||||
if(in_array($this->view,array('year','planner')) && $_GET['view'])
|
||||
{
|
||||
$GLOBALS['egw_info']['flags']['nonavbar'] = true;
|
||||
$this->manage_states($_GET);
|
||||
$old_calendar = $this->{$this->view}();
|
||||
echo $old_calendar;
|
||||
return;
|
||||
}
|
||||
$this->sidebox_etemplate(array('old_calendar' => $old_calendar));
|
||||
|
||||
// Load the different views once, we'll switch between them on the client side
|
||||
$tmpl = new etemplate_new('calendar.todo');
|
||||
|
@ -151,11 +151,10 @@ app.classes.calendar = AppJS.extend(
|
||||
init: function()
|
||||
{
|
||||
// make calendar object available, even if not running in top window, as sidebox does
|
||||
if (window.top !== window && !egw(window).is_popup())
|
||||
if (window.top !== window && !egw(window).is_popup() && window.top.app.calendar)
|
||||
{
|
||||
// we have to explicitly delete old object or IE11 complains about accessing an already freed script
|
||||
delete window.top.app.calendar;
|
||||
window.top.app.calendar = this;
|
||||
window.app.calendar = window.top.app.calendar;
|
||||
return;
|
||||
}
|
||||
|
||||
// call parent
|
||||
@ -368,6 +367,17 @@ app.classes.calendar = AppJS.extend(
|
||||
{
|
||||
return _url.replace(/menuaction=[^&]+/, 'menuaction=calendar.calendar_uilist.listview&ajax=true');
|
||||
}
|
||||
else if (this.sidebox_et2 && typeof this.views[state.view] == 'undefined')
|
||||
{
|
||||
this.sidebox_et2.getWidgetById('iframe').set_src(_url);
|
||||
this.sidebox
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (_url.indexOf('menuaction=calendar.calendar_uiviews') >= 0)
|
||||
{
|
||||
this.sidebox_et2.getWidgetById('iframe').set_src(_url);
|
||||
return true;
|
||||
}
|
||||
// can not load our own index page, has to be done by framework
|
||||
return false;
|
||||
@ -1237,6 +1247,11 @@ app.classes.calendar = AppJS.extend(
|
||||
*/
|
||||
update_state: function(_set)
|
||||
{
|
||||
// Make sure we're running in top window
|
||||
if(window !== window.top)
|
||||
{
|
||||
return window.top.app.calendar.update_state(_set);
|
||||
}
|
||||
var changed = [];
|
||||
var new_state = jQuery.extend({}, this.state);
|
||||
if (typeof _set == 'object')
|
||||
@ -1276,11 +1291,6 @@ app.classes.calendar = AppJS.extend(
|
||||
state = egw_script_tag.getAttribute('data-calendar-state');
|
||||
state = state ? JSON.parse(state) : {};
|
||||
}
|
||||
// we are currently in list-view
|
||||
if (this.et2 && this.et2.getWidgetById('nm'))
|
||||
{
|
||||
jQuery.extend(state, this._super.apply(this, arguments)); // call default implementation
|
||||
}
|
||||
|
||||
// Don't store current user in state to allow admins to create favourites for all
|
||||
// Should make no difference for normal users.
|
||||
@ -1318,9 +1328,26 @@ app.classes.calendar = AppJS.extend(
|
||||
{
|
||||
state.state.date = new Date();
|
||||
}
|
||||
|
||||
|
||||
// Hide other views
|
||||
for(var _view in this.views)
|
||||
{
|
||||
if(state.state.view != _view && this.views[_view])
|
||||
{
|
||||
for(var i = 0; i < this.views[_view].etemplates.length; i++)
|
||||
{
|
||||
$j(this.views[_view].etemplates[i].DOMContainer).hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
$j(this.sidebox_et2.getInstanceManager().DOMContainer).hide();
|
||||
|
||||
// Check for a supported client-side view
|
||||
if(this.views[state.state.view])
|
||||
if(this.views[state.state.view] &&
|
||||
// Check that the view is instanciated
|
||||
typeof this.views[state.state.view].etemplates[0] !== 'string' && this.views[state.state.view].etemplates[0].widgetContainer
|
||||
)
|
||||
{
|
||||
// Doing an update - this includes the selected view, and the sidebox
|
||||
// We set a flag to ignore changes from the sidebox which would
|
||||
@ -1378,13 +1405,13 @@ app.classes.calendar = AppJS.extend(
|
||||
{
|
||||
// Need to redo the number of grids
|
||||
var value = [];
|
||||
var date = view.set_start_date(state.state);
|
||||
var date = state.state.first = view.set_start_date(state.state);
|
||||
|
||||
// Determine the different end date
|
||||
switch(state.state.view)
|
||||
{
|
||||
case 'month':
|
||||
var end = view.set_end_date(state.state);
|
||||
var end = state.state.last = view.set_end_date(state.state);
|
||||
grid_count = Math.ceil((end - date) / (1000 * 60 * 60 * 24) / 7);
|
||||
// fall through
|
||||
case 'weekN':
|
||||
@ -1400,9 +1427,10 @@ app.classes.calendar = AppJS.extend(
|
||||
value.push(val);
|
||||
date.setUTCHours(24*7);
|
||||
}
|
||||
state.state.last=val.end_date;
|
||||
break;
|
||||
default:
|
||||
var end = view.set_end_date(state.state);
|
||||
var end = state.state.last = view.set_end_date(state.state);
|
||||
for(var owner = 0; owner < grid_count && owner < state.state.owner.length; owner++)
|
||||
{
|
||||
value.push({
|
||||
@ -1430,6 +1458,8 @@ app.classes.calendar = AppJS.extend(
|
||||
if(typeof view[updater] === 'function')
|
||||
{
|
||||
var value = view[updater].call(this,state.state);
|
||||
if(updater === 'set_start_date') state.state.first = value.toJSON();
|
||||
if(updater === 'set_end_date') state.state.last = value.toJSON();
|
||||
|
||||
// Set value
|
||||
for(var i = 0; i < view.etemplates.length; i++)
|
||||
@ -1444,19 +1474,9 @@ app.classes.calendar = AppJS.extend(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Hide other views
|
||||
for(var _view in this.views)
|
||||
{
|
||||
if(state.state.view != _view && this.views[_view])
|
||||
{
|
||||
for(var i = 0; i < this.views[_view].etemplates.length; i++)
|
||||
{
|
||||
$j(this.views[_view].etemplates[i].DOMContainer).hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
// Include first & last dates in state, mostly for server side processing
|
||||
if(state.state.first && state.state.first.toJSON) state.state.first = state.state.first.toJSON()
|
||||
if(state.state.last && state.state.last.toJSON) state.state.last = state.state.last.toJSON()
|
||||
|
||||
// Show the templates for the current view
|
||||
for(var i = 0; i < view.etemplates.length; i++)
|
||||
@ -1605,7 +1625,8 @@ app.classes.calendar = AppJS.extend(
|
||||
}
|
||||
}
|
||||
// setting internal state now, that linkHandler does not intercept switching from listview to any old view
|
||||
this.state = state;
|
||||
this.state = jQuery.extend({},state.state);
|
||||
$j(this.sidebox_et2.getInstanceManager().DOMContainer).show();
|
||||
|
||||
var query = jQuery.extend({menuaction: menuaction},state.state||{});
|
||||
|
||||
|
@ -31,7 +31,7 @@ Egroupware
|
||||
<buttononly align="center" class="sideboxstar" id="week" image="week" label="Weekview" onclick="app.calendar.update_state({view:'week'});"/>
|
||||
<buttononly align="center" class="sideboxstar" id="weekN" image="multiweek" label="Multiple week view" onclick="app.calendar.update_state({view:'weekN'});"/>
|
||||
<buttononly align="center" class="sideboxstar" id="month" image="month" label="Multiple week view" onclick="app.calendar.update_state({view:'month'});"/>
|
||||
<buttononly align="center" class="sideboxstar" id="planner" image="planner" label="Group planner"/>
|
||||
<buttononly align="center" class="sideboxstar" id="planner" image="planner" label="Group planner" onclick="app.calendar.update_state({view:'planner'});"/>
|
||||
<buttononly align="center" class="sideboxstar" id="listview" image="list" label="Listview" onclick="app.calendar.update_state({view:'listview'});"/>
|
||||
</row>
|
||||
</rows>
|
||||
@ -39,6 +39,8 @@ Egroupware
|
||||
<select id="view" class="et2_fullWidth" onchange="app.calendar.update_state(JSON.parse(widget.getValue()));"/>
|
||||
<textbox id="keywords" class="et2_fullWidth" onchange="app.calendar.update_state({keywords: widget.getValue()});"/>
|
||||
<date id="date" class="et2_fullWidth" inline="true" onchange="app.calendar.update_state({date:widget.getValue(),view:'day'});"/>
|
||||
<textbox type="hidden" id="first"/>
|
||||
<textbox type="hidden" id="last"/>
|
||||
<hbox width="100%">
|
||||
<select-cat id="cat_id" empty_label="All categories" width="86%" onchange="app.calendar.update_state({cat_id: widget.getValue()});"/>
|
||||
<button align="right" id="cat_id_multiple" image="category"/>
|
||||
@ -50,8 +52,8 @@ Egroupware
|
||||
<taglist id="owner" class="et2_fullWidth" onchange="app.calendar.update_state({owner: widget.getValue()});" autocomplete_params=''/>
|
||||
-->
|
||||
<select id="filter" no_lang="true" class="et2_fullWidth" onchange="app.calendar.update_state({filter: widget.getValue()});"/>
|
||||
<select id="merge" empty_label="Insert in document" onchange="widget.getInstanceManager().postSubmit();widget.set_value('');" class="et2_fullWidth"/>/>
|
||||
<select id="merge" empty_label="Insert in document" onchange="if(widget.getValue()) {widget.getInstanceManager().postSubmit();}window.setTimeout(function() {widget.set_value('');},100);return false;" class="et2_fullWidth"/>/>
|
||||
</vbox>
|
||||
<html id="old_calendar"/>
|
||||
<iframe id="iframe" width="100%" height="100%"/>
|
||||
</template>
|
||||
</overlay>
|
||||
|
Loading…
Reference in New Issue
Block a user