Author: nathangray
New Revision: 55124
URL: http://svn.stylite.de/viewvc/egroupware?rev=55124&view=rev
Log:
Get calendar home less broken
- Fix actions missing on home reload
- Fix full reload on home reload
- Fix calendar reload removed home events
Modified:
trunk/calendar/inc/class.calendar_favorite_portlet.inc.php
trunk/calendar/inc/class.calendar_uiviews.inc.php
trunk/calendar/js/app.js
trunk/calendar/js/calendar_favorite_portlet.js
trunk/calendar/js/et2_widget_event.js
trunk/calendar/js/et2_widget_planner.js
trunk/calendar/js/et2_widget_timegrid.js
trunk/egroupware/home/inc/class.home_favorite_portlet.inc.php
trunk/egroupware/home/js/app.js
— trunk/calendar/inc/class.calendar_favorite_portlet.inc.php (original)
+++ trunk/calendar/inc/class.calendar_favorite_portlet.inc.php Tue Feb 23 22:29:13 2016
@@ -58,6 +58,9 @@
public function exec($id = null, etemplate_new &$etemplate = null)
{
-
// Always load app's javascript, so most actions have a chance of working
-
egw_framework::validate_file('.','app',$this->context['appname']);
-
// Always load app's css
egw_framework::includeCSS('calendar', 'app-'.$GLOBALS['egw_info']['user']['preferences']['common']['theme']) ||
egw_framework::includeCSS('calendar','app');
@@ -86,8 +89,6 @@
$etemplate->read(‘home.legacy’);
$etemplate->set_dom_id($id);
-
// Always load app's javascript, so most actions have a chance of working
-
egw_framework::validate_file('','app',$this->context['appname']);
}
$content = array('legacy' => '');
@@ -143,7 +144,7 @@
$this->favorite[‘state’][‘view’] == ‘day’ ? 1 : 4
);
$this->actions =& $etemplate->getElementAttribute(‘view’, ‘actions’);
— trunk/calendar/inc/class.calendar_uiviews.inc.php (original)
+++ trunk/calendar/inc/class.calendar_uiviews.inc.php Tue Feb 23 22:29:13 2016
@@ -612,12 +612,18 @@
$search_params[‘start’] = $week_start->format(‘ts’);
$search_params[‘end’] = $week_end->format(‘ts’);
-
$content['view'][] = (array)$this->tagWholeDayOnTop($this->bo->search($search_params)) +
-
array(
-
'id' => $week_start->format('Ymd')
-
);
$home->setElementAttribute("view[$week]",'onchange',false);
$home->setElementAttribute("view[$week]",'granularity',$granularity);
$home->setElementAttribute("view[$week]",'show_weekend', $this->search_params['weekend']);
$week++;
}
-
-
// Get the actions
-
$home->setElementAttribute('view','actions',$this->get_actions());
$home->exec(__METHOD__, $content);
}
— trunk/calendar/js/app.js (original)
+++ trunk/calendar/js/app.js Tue Feb 23 22:29:13 2016
@@ -74,6 +74,9 @@
// Calendar allows other apps to hook into the sidebox. We keep these etemplates
// up to date as state is changed.
sidebox_hooked_templates: [],
+
-
// List of queries in progress, to prevent home from requesting the same thing
-
_queries_in_progress: [],
/**
- Constructor
@@ -2724,6 +2727,14 @@
// Show ajax loader
framework.applications.calendar.sidemenuEntry.showAjaxLoader()
-
// Already in progress?
-
var query_string = JSON.stringify(query);
-
if(this._queries_in_progress.indexOf(query_string) != -1)
-
{
-
return;
-
}
-
this._queries_in_progress.push(query_string);
-
this.egw.dataFetch(
instance ? instance.etemplate_exec_id :
this.sidebox_et2.getInstanceManager().etemplate_exec_id,
@@ -2731,7 +2742,13 @@
query,
this.id,
function calendar_handleResponse(data) {
-
var idx = this._queries_in_progress.indexOf(query_string);
-
if(idx >= 0)
-
{
-
this._queries_in_progress.splice(idx,1);
-
}
-
//console.log(data);
-
// Look for any updated select options
if(data.rows && data.rows.sel_options && this.sidebox_et2)
{
— trunk/calendar/js/calendar_favorite_portlet.js (original)
+++ trunk/calendar/js/calendar_favorite_portlet.js Tue Feb 23 22:29:13 2016
@@ -27,38 +27,47 @@
// List view, we can just update it
this.portlet.getWidgetById(‘nm’).refresh(_id,_type);
}
- else if (_id)
- {
-
// Calendar app should handle it in its observer()
- }
- else if (app.classes.calendar && app.calendar)
- {
-
// No ID, probably a refresh of app. Calendar will discard the cache.
-
// Only make a request if:
-
// - portlet date range is outside calendar state range
-
// - portlet owner is not in calendar state owner
-
// Otherwise, we'll kill the connection with several overlapping requests
-
-
var value = [];
-
var state = this.portlet.options.settings.favorite.state;
-
if(state.owner == 0) state.owner = [egw.user('account_id')];
-
this.portlet.iterateOver(function(view) {
-
value.push({
-
owner: view.options.owner,
-
start_date: view.options.start_date,
-
end_date: view.options.end_date
-
})
-
state.first = !state.first || state.first > view.options.start_date ? view.options.start_date : state.first;
-
state.last = !state.last || state.last < view.options.end_date ? view.options.end_date : state.last;
-
},this, et2_calendar_view);
-
-
if(state.first < new Date(app.calendar.state.first) || state.last > new Date(app.calendar.state.last) ||
-
state.owner != app.calendar.state.owner)
-
{
-
app.calendar.et2 = this.portlet._children[0]
-
app.calendar._need_data(value, state);
-
}
- }
else
{
-
// No intelligence since we don't have access to the state
-
// (app.calendar.getState() is for the calendar tab, not home)
-
// just refresh on every calendar or infolog change
-
if(_app == 'calendar' || _app == 'infolog')
{
-
var new_cache_id = app.classes.calendar._daywise_cache_id(
-
event.data.date,
-
// Make sure to use the right owner, not current calendar state
-
this.portlet.settings.favorite.state.owner || ''
-
);
-
var daywise = egw.dataGetUIDdata(new_cache_id);
-
daywise = daywise ? daywise.data : [];
-
if(_type === 'delete')
-
{
-
daywise.splice(daywise.indexOf(_id),1);
-
}
-
else if (daywise.indexOf(_id) < 0)
-
{
-
daywise.push(_id);
-
}
-
egw.dataStoreUID(new_cache_id,daywise);
-
}
-
else
-
{
-
// No intelligence since we don't have access to the state
-
// (app.calendar.getState() is for the calendar tab, not home)
-
// just refresh on every calendar or infolog change
-
if(_app == 'calendar' || _app == 'infolog')
-
{
-
app.home.refresh(this.portlet.id);
-
}
-
}
— trunk/calendar/js/et2_widget_event.js (original)
+++ trunk/calendar/js/et2_widget_event.js Tue Feb 23 22:29:13 2016
@@ -235,7 +235,19 @@
}
// Copy actions set in parent
-
var action_parent = this;
-
while(action_parent != null && !action_parent.options.actions &&
-
!action_parent.instanceOf(et2_container)
-
)
-
{
-
action_parent = action_parent.getParent();
-
}
-
try {
-
this._link_actions(action_parent.options.actions||{});
-
} catch (e) {
-
// something went wrong, but keep quiet about it
-
debugger;
-
}
// Make sure category stuff is there
// Fake it to use the cache / call - if already there, these will return
@@ -853,7 +865,7 @@
// objects
this._actionObject = objectManager.insertObject(false, new egwActionObject(
‘calendar::’+this.options.value.row_id, objectManager, new et2_event_action_object_impl(this,this.getDOMNode()),
— trunk/calendar/js/et2_widget_planner.js (original)
+++ trunk/calendar/js/et2_widget_planner.js Tue Feb 23 22:29:13 2016
@@ -732,7 +732,7 @@
this.widget.update_timer = null;
this.widget.doInvalidate = true;
-
window.setTimeout(jQuery.proxy(function() {if(this.loader) this.loader.hide();},this.widget),100);
},{widget:this,"trigger":trigger}),ET2_GRID_INVALIDATE_TIMEOUT);
},
— trunk/calendar/js/et2_widget_timegrid.js (original)
+++ trunk/calendar/js/et2_widget_timegrid.js Tue Feb 23 22:29:13 2016
@@ -950,6 +950,8 @@
*/
_scroll: function(event)
{
-
if(!this.day_widgets) return;
-
// Loop through days, let them deal with it
for(var day = 0; day < this.day_widgets.length; day++)
{
@@ -1013,7 +1015,7 @@
for(var i = 0; i < parent.children.length; i++)
{
@@ -1303,7 +1305,7 @@
* necessarily an entry from the resource app), or a list containing a
* combination of both.
*/
- set_value: function(events)
- set_value: function set_value(events)
{
if(typeof events !== ‘object’) return false;
@@ -1328,26 +1330,35 @@
this.set_start_date(day_list[0]);
this.set_end_date(day_list[day_list.length-1]);
}
-
// Sub widgets actually get their own data from egw.data, so we'll
-
// stick it there
-
var consolidated = et2_calendar_view.is_consolidated(this.options.owner, this.day_list.length == 1 ? 'day' : 'week');
-
for(var day in events)
-
{
-
var day_list = [];
-
for(var i = 0; i < events[day].length; i++)
-
{
-
day_list.push(events[day][i].row_id);
-
egw.dataStoreUID('calendar::'+events[day][i].row_id, events[day][i]);
-
-
// We need to check if we're attached already, as the datastore can cause
-
// conflicts across other events (especially home) if we call it too early
-
if(this.isAttached())
-
{
-
// Sub widgets actually get their own data from egw.data, so we'll
-
// stick it there
-
var consolidated = et2_calendar_view.is_consolidated(this.options.owner, this.day_list.length == 1 ? 'day' : 'week');
-
for(var day in events)
-
{
-
var day_list = [];
-
for(var i = 0; i < events[day].length; i++)
-
{
-
day_list.push(events[day][i].row_id);
-
egw.dataStoreUID('calendar::'+events[day][i].row_id, events[day][i]);
-
}
-
// Might be split by user, so we have to check that too
-
for(var i = 0; i < this.options.owner.length; i++)
-
{
-
var owner = consolidated ? this.options.owner : this.options.owner[i];
-
var day_id = app.classes.calendar._daywise_cache_id(day,owner);
-
egw.dataStoreUID(day_id, day_list);
-
if(consolidated) break;
-
}
}
-
// Might be split by user, so we have to check that too
-
for(var i = 0; i < this.options.owner.length; i++)
-
{
-
var owner = consolidated ? this.options.owner : this.options.owner[i];
-
var day_id = app.classes.calendar._daywise_cache_id(day,owner);
-
egw.dataStoreUID(day_id, day_list);
-
if(consolidated) break;
-
}
-
}
-
else
-
{
-
this.value = events;
}
}
@@ -1781,9 +1792,10 @@
{
this.options.height = Math.max(this.options.height, needed);
// Set all others to match
-
if(!_too_small && rowCount > 1 && this._parent)
{
window.setTimeout(jQuery.proxy(function() {
-
if(!this._parent) return;
this._parent.iterateOver(function(widget) {
if(!widget.disabled) widget.resize(true);
},this, et2_calendar_timegrid);
— trunk/egroupware/home/inc/class.home_favorite_portlet.inc.php (original)
+++ trunk/egroupware/home/inc/class.home_favorite_portlet.inc.php Tue Feb 23 22:29:13 2016
@@ -125,7 +125,7 @@
egw_framework::includeCSS($this->context[‘appname’],‘app’);
// Always load app's javascript, so most actions have a chance of working
— trunk/egroupware/home/js/app.js (original)
+++ trunk/egroupware/home/js/app.js Tue Feb 23 22:29:13 2016
@@ -157,13 +157,15 @@
// Check for existing etemplate, this one loaded over it
// NOTE: Moving them around like this can cause problems with event handlers
var existing = etemplate2.getById(et2.uniqueId);
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