fixed or working around javascript errors in IE11

This commit is contained in:
Ralf Becker 2014-02-19 15:20:19 +00:00
parent d3f2b0a1f9
commit 07db88276e
3 changed files with 55 additions and 56 deletions

View File

@ -419,21 +419,25 @@ class calendar_ui
$GLOBALS['egw']->preferences->add('calendar','saved_states',$saved_states); $GLOBALS['egw']->preferences->add('calendar','saved_states',$saved_states);
$GLOBALS['egw']->preferences->save_repository(false,'user',true); $GLOBALS['egw']->preferences->save_repository(false,'user',true);
} }
// store state in request for clientside favorites to use // only run for calendar views
// remove date and other states never stored in a favorite if (in_array(gettype($this), array('calendar_uilist', 'calendar_uiviews')))
$states = array_diff_key($states,array('date'=>false,'year'=>false,'month'=>false,'day'=>false,'save_owner'=>false));
if (strpos($_GET['menuaction'], 'ajax_sidebox') !== false)
{ {
// sidebox request is from top frame, which has app.calendar NOT loaded by time response arrives // store state in request for clientside favorites to use
} // remove date and other states never stored in a favorite
elseif (egw_json_request::isJSONRequest()) $states = array_diff_key($states,array('date'=>false,'year'=>false,'month'=>false,'day'=>false,'save_owner'=>false));
{ if (strpos($_GET['menuaction'], 'ajax_sidebox') !== false)
$response = egw_json_response::get(); {
$response->apply('app.calendar.set_state', array($states, $_GET['menuaction'])); // sidebox request is from top frame, which has app.calendar NOT loaded by time response arrives
} }
else elseif (egw_json_request::isJSONRequest())// && strpos($_GET['menuaction'], 'calendar_uiforms') === false)
{ {
egw_framework::set_extra('calendar', 'state', $states); $response = egw_json_response::get();
$response->apply('app.calendar.set_state', array($states, $_GET['menuaction']));
}
else
{
egw_framework::set_extra('calendar', 'state', $states);
}
} }
} }
} }

View File

@ -210,7 +210,7 @@ class calendar_uiviews extends calendar_ui
// handle views in other files // handle views in other files
if (!isset($this->public_functions[$this->view])) if (!isset($this->public_functions[$this->view]))
{ {
$GLOBALS['egw']->redirect_link('/index.php',array('menuaction'=>$this->view_menuaction)); $GLOBALS['egw']->redirect_link('/index.php',array('menuaction'=>$this->view_menuaction,'ajax'=>'true'),'calendar');
} }
// get manual to load the right page // get manual to load the right page
$GLOBALS['egw_info']['flags']['params']['manual'] = array('page' => 'ManualCalendar'.ucfirst($this->view)); $GLOBALS['egw_info']['flags']['params']['manual'] = array('page' => 'ManualCalendar'.ucfirst($this->view));

View File

@ -36,7 +36,7 @@ app.classes.calendar = AppJS.extend(
this._super.apply(this, arguments); this._super.apply(this, arguments);
// make calendar object available, even if not running in top window, as sidebox does // make calendar object available, even if not running in top window, as sidebox does
if (window.top !== window && typeof window.top.app.calendar == 'undefined') if (window.top !== window)
{ {
window.top.app.calendar = this; window.top.app.calendar = this;
} }
@ -55,7 +55,7 @@ app.classes.calendar = AppJS.extend(
// remove top window reference // remove top window reference
if (window.top !== window && window.top.app.calendar === this) if (window.top !== window && window.top.app.calendar === this)
{ {
delete window.top.app.calendar; delete window.top.app.calendar;
} }
}, },
@ -64,9 +64,10 @@ app.classes.calendar = AppJS.extend(
* and ready. If you must store a reference to the et2 object, * and ready. If you must store a reference to the et2 object,
* make sure to clean it up in destroy(). * make sure to clean it up in destroy().
* *
* @param et2 etemplate2 Newly ready object * @param {etemplate2} _et2 newly ready et2 object
* @param {string} _name name of template
*/ */
et2_ready: function(et2) et2_ready: function(_et2, _name)
{ {
// call parent // call parent
this._super.apply(this, arguments); this._super.apply(this, arguments);
@ -82,45 +83,39 @@ app.classes.calendar = AppJS.extend(
var content = this.et2.getArrayMgr('content'); var content = this.et2.getArrayMgr('content');
if (typeof et2.templates['calendar.list'] != 'undefined') switch (_name)
{ {
try { case 'calendar.list':
// check if listview runs in an iframe --> use linkHandler to open it top-level this.filter_change();
if (top.egw && top != window && window.framework) break;
case 'calendar.edit':
if (typeof content.data['conflicts'] == 'undefined')
{ {
window.framework.linkHandler(document.location.href+'&ajax=true', 'calendar'); $j(document.getElementById('calendar-edit_calendar-delete_series')).hide();
//Check if it's fallback from conflict window or it's from edit window
if (content.data['button_was'] != 'freetime')
{
this.set_enddate_visibility();
this.check_recur_type();
this.et2.getWidgetById('recur_exception').set_disabled(typeof content.data['recur_exception'][0] == 'undefined');
}
else
{
this.freetime_search();
}
//send Syncronus ajax request to the server to unlock the on close entry
//set onbeforeunload with json request to send request when the window gets close by X button
window.onbeforeunload = function () {
this.egw.json('calendar.calendar_uiforms.ajax_unlock'
, [content.data['id'],content.data['lock_token']],null,true,null,null).sendRequest(true);
};
} }
} break;
catch(e) {
// ignore error eg. comming because we have a top not belonging to EGroupware case 'calendar.freetimesearch':
}
this.filter_change();
}
if (typeof et2.templates['calendar.edit'] != 'undefined' && typeof content.data['conflicts'] == 'undefined')
{
$j(document.getElementById('calendar-edit_calendar-delete_series')).hide();
//Check if it's fallback from conflict window or it's from edit window
if (content.data['button_was'] != 'freetime')
{
this.set_enddate_visibility(); this.set_enddate_visibility();
this.check_recur_type(); break;
this.et2.getWidgetById('recur_exception').set_disabled(typeof content.data['recur_exception'][0] == 'undefined');
}
else
{
this.freetime_search();
}
//send Syncronus ajax request to the server to unlock the on close entry
//set onbeforeunload with json request to send request when the window gets close by X button
window.onbeforeunload = function () {
this.egw.json('calendar.calendar_uiforms.ajax_unlock'
, [content.data['id'],content.data['lock_token']],null,true,null,null).sendRequest(true);
};
}
//this.replace_eTemplate_onsubmit();
if (typeof et2.templates['calendar.freetimesearch'] != 'undefined')
{
this.set_enddate_visibility();
} }
}, },
@ -790,8 +785,8 @@ app.classes.calendar = AppJS.extend(
*/ */
filter_change: function() filter_change: function()
{ {
var filter = this.et2.getWidgetById('filter'); var filter = this.et2 ? this.et2.getWidgetById('filter') : null;
var dates = this.et2.getWidgetById('calendar.list.dates'); var dates = this.et2 ? this.et2.getWidgetById('calendar.list.dates') : null;
if (filter && dates) if (filter && dates)
{ {