forked from extern/egroupware
instanciate app.js object from egw.js, so non et2 apps can use it too, get et2_dialog working from app.calendar outside listview
This commit is contained in:
parent
eba4b8cee3
commit
aeb6ebd84c
@ -225,6 +225,18 @@ class calendar_ui
|
|||||||
*/
|
*/
|
||||||
function do_header()
|
function do_header()
|
||||||
{
|
{
|
||||||
|
// Include the jQuery-UI CSS - many more complex widgets use it
|
||||||
|
$theme = 'redmond';
|
||||||
|
egw_framework::includeCSS("/phpgwapi/js/jquery/jquery-ui/$theme/jquery-ui-1.10.3.custom.css");
|
||||||
|
// Load our CSS after jQuery-UI, so we can override it
|
||||||
|
egw_framework::includeCSS('/etemplate/templates/default/etemplate2.css');
|
||||||
|
|
||||||
|
// load etemplate2
|
||||||
|
egw_framework::validate_file('/etemplate/js/etemplate2.js');
|
||||||
|
|
||||||
|
// load our app.js file
|
||||||
|
egw_framework::validate_file('/calendar/js/app.js');
|
||||||
|
|
||||||
// tell egw_framework to include wz_tooltip
|
// tell egw_framework to include wz_tooltip
|
||||||
$GLOBALS['egw_info']['flags']['include_wz_tooltip'] = true;
|
$GLOBALS['egw_info']['flags']['include_wz_tooltip'] = true;
|
||||||
common::egw_header();
|
common::egw_header();
|
||||||
|
@ -9,6 +9,10 @@
|
|||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*egw:uses
|
||||||
|
/etemplate/js/etemplate2.js
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UI for calendar
|
* UI for calendar
|
||||||
*
|
*
|
||||||
@ -20,15 +24,7 @@ app.classes.calendar = AppJS.extend(
|
|||||||
* application name
|
* application name
|
||||||
*/
|
*/
|
||||||
appname: 'calendar',
|
appname: 'calendar',
|
||||||
/**
|
|
||||||
* et2 widget container
|
|
||||||
*/
|
|
||||||
et2: null,
|
|
||||||
/**
|
|
||||||
* edit_series vars
|
|
||||||
*/
|
|
||||||
calendar_edit_id: null,
|
|
||||||
calendar_edit_date: null,
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -45,10 +41,8 @@ app.classes.calendar = AppJS.extend(
|
|||||||
*/
|
*/
|
||||||
destroy: function()
|
destroy: function()
|
||||||
{
|
{
|
||||||
delete this.et2;
|
|
||||||
// call parent
|
// call parent
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -99,6 +93,7 @@ app.classes.calendar = AppJS.extend(
|
|||||||
/**
|
/**
|
||||||
* open the freetime search popup
|
* open the freetime search popup
|
||||||
*
|
*
|
||||||
|
* @param {string} _link
|
||||||
*/
|
*/
|
||||||
freetime_search_popup: function(_link)
|
freetime_search_popup: function(_link)
|
||||||
{
|
{
|
||||||
@ -153,9 +148,10 @@ app.classes.calendar = AppJS.extend(
|
|||||||
/**
|
/**
|
||||||
* handles actions selectbox in calendar edit popup
|
* handles actions selectbox in calendar edit popup
|
||||||
*
|
*
|
||||||
* @param {widget object} widget, widget "actions selectBox" in edit popup window
|
* @param {mixed} _event
|
||||||
|
* @param {et2_base_widget} widget, widget "actions selectBox" in edit popup window
|
||||||
*/
|
*/
|
||||||
actions_change: function(egw,widget)
|
actions_change: function(_event, widget)
|
||||||
{
|
{
|
||||||
var event = this.et2.getArrayMgr('content').data;
|
var event = this.et2.getArrayMgr('content').data;
|
||||||
if (widget)
|
if (widget)
|
||||||
@ -184,20 +180,22 @@ app.classes.calendar = AppJS.extend(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* open mail compose popup window
|
* open mail compose popup window
|
||||||
*
|
*
|
||||||
* @param {Array} vars,
|
* @param {Array} vars
|
||||||
* @todo need to provide right mail compose from server to custom_mail function
|
* @todo need to provide right mail compose from server to custom_mail function
|
||||||
*/
|
*/
|
||||||
custom_mail: function (vars)
|
custom_mail: function (vars)
|
||||||
{
|
{
|
||||||
this.egw.open_link('mail.mail_compose.compose&','_blank','700x700');
|
this.egw.open_link('mail.mail_compose.compose&','_blank','700x700');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* control delete_series popup visibility
|
* control delete_series popup visibility
|
||||||
*
|
*
|
||||||
* @param {Array} exceptions, an array contains number of exception entries
|
* @param {Array} exceptions an array contains number of exception entries
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
delete_btn: function(exceptions)
|
delete_btn: function(exceptions)
|
||||||
@ -206,7 +204,6 @@ app.classes.calendar = AppJS.extend(
|
|||||||
|
|
||||||
if (exceptions)
|
if (exceptions)
|
||||||
{
|
{
|
||||||
|
|
||||||
$j(document.getElementById('calendar-edit_calendar-delete_series')).show();
|
$j(document.getElementById('calendar-edit_calendar-delete_series')).show();
|
||||||
}
|
}
|
||||||
else if (content['recur_type'] !== 0)
|
else if (content['recur_type'] !== 0)
|
||||||
@ -223,10 +220,11 @@ app.classes.calendar = AppJS.extend(
|
|||||||
* print_participants_status(egw,widget)
|
* print_participants_status(egw,widget)
|
||||||
* Handle to apply changes from status in print popup
|
* Handle to apply changes from status in print popup
|
||||||
*
|
*
|
||||||
* @param {widget object} widget, widget "status" in print popup window
|
* @param {mixed} _event
|
||||||
|
* @param {et2_base_widget} widget widget "status" in print popup window
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
print_participants_status: function(egw,widget)
|
print_participants_status: function(_event, widget)
|
||||||
{
|
{
|
||||||
if (widget && window.opener)
|
if (widget && window.opener)
|
||||||
{
|
{
|
||||||
@ -252,10 +250,11 @@ app.classes.calendar = AppJS.extend(
|
|||||||
* Handles to select freetime, and replace the selected one on Start,
|
* Handles to select freetime, and replace the selected one on Start,
|
||||||
* and End date&time in edit calendar entry popup.
|
* and End date&time in edit calendar entry popup.
|
||||||
*
|
*
|
||||||
* @param {widget object} _widget, widget "select button" in freetime search popup window
|
* @param {mixed} _event
|
||||||
|
* @param {et2_base_widget} _widget widget "select button" in freetime search popup window
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
freetime_select: function(_egw,_widget)
|
freetime_select: function(_event, _widget)
|
||||||
{
|
{
|
||||||
if (_widget)
|
if (_widget)
|
||||||
{
|
{
|
||||||
@ -312,6 +311,8 @@ app.classes.calendar = AppJS.extend(
|
|||||||
/**
|
/**
|
||||||
* this function try to fix ids which are from integrated apps
|
* this function try to fix ids which are from integrated apps
|
||||||
*
|
*
|
||||||
|
* @param {egw_action} _action
|
||||||
|
* @param {Array} _senders
|
||||||
*/
|
*/
|
||||||
cal_fix_app_id: function(_action, _senders)
|
cal_fix_app_id: function(_action, _senders)
|
||||||
{
|
{
|
||||||
@ -322,7 +323,7 @@ app.classes.calendar = AppJS.extend(
|
|||||||
{
|
{
|
||||||
id = matches[1];
|
id = matches[1];
|
||||||
}
|
}
|
||||||
else if (matches = id.match(/^([a-z_-]+)([0-9]+)/i))
|
else if ((matches = id.match(/^([a-z_-]+)([0-9]+)/i)))
|
||||||
{
|
{
|
||||||
app = matches[1];
|
app = matches[1];
|
||||||
id = matches[2];
|
id = matches[2];
|
||||||
@ -357,7 +358,7 @@ app.classes.calendar = AppJS.extend(
|
|||||||
this.edit_series(matches[1],matches[2]);
|
this.edit_series(matches[1],matches[2]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (matches = id.match(/^([a-z_-]+)([0-9]+)/i))
|
else if ((matches = id.match(/^([a-z_-]+)([0-9]+)/i)))
|
||||||
{
|
{
|
||||||
var app = matches[1];
|
var app = matches[1];
|
||||||
_action.data.url = window.egw_webserverUrl+'/index.php?';
|
_action.data.url = window.egw_webserverUrl+'/index.php?';
|
||||||
@ -367,7 +368,7 @@ app.classes.calendar = AppJS.extend(
|
|||||||
_action.data.url += name+"="+encodeURIComponent(get_params[name])+"&";
|
_action.data.url += name+"="+encodeURIComponent(get_params[name])+"&";
|
||||||
|
|
||||||
if (js_integration_data[app].edit_popup &&
|
if (js_integration_data[app].edit_popup &&
|
||||||
(matches = js_integration_data[app].edit_popup.match(/^(.*)x(.*)$/)))
|
((matches = js_integration_data[app].edit_popup.match(/^(.*)x(.*)$/))))
|
||||||
{
|
{
|
||||||
_action.data.width = matches[1];
|
_action.data.width = matches[1];
|
||||||
_action.data.height = matches[2];
|
_action.data.height = matches[2];
|
||||||
@ -420,7 +421,8 @@ app.classes.calendar = AppJS.extend(
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (row = jQuery("#"+id+"\\:"+date)) {
|
if ((row = jQuery("#"+id+"\\:"+date)))
|
||||||
|
{
|
||||||
// Open at row
|
// Open at row
|
||||||
popup.css({
|
popup.css({
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
@ -447,13 +449,12 @@ app.classes.calendar = AppJS.extend(
|
|||||||
/**
|
/**
|
||||||
* Create edit exception dialog for recurrence entries
|
* Create edit exception dialog for recurrence entries
|
||||||
*
|
*
|
||||||
* @param {timestamp} date
|
* @param {object} event
|
||||||
* @param {string} id, cal_id
|
* @param {string} id cal_id
|
||||||
* @param {type} name description
|
* @param {integer} date timestamp
|
||||||
*/
|
*/
|
||||||
edit_series: function(event,id,date)
|
edit_series: function(event,id,date)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Coming from list, there is no event
|
// Coming from list, there is no event
|
||||||
if(arguments.length == 2)
|
if(arguments.length == 2)
|
||||||
{
|
{
|
||||||
@ -461,40 +462,31 @@ app.classes.calendar = AppJS.extend(
|
|||||||
id = event;
|
id = event;
|
||||||
event = null;
|
event = null;
|
||||||
}
|
}
|
||||||
calendar_edit_id = id;
|
var edit_id = id;
|
||||||
calendar_edit_date = date;
|
var edit_date = date;
|
||||||
var that = this;
|
var that = this;
|
||||||
var buttons = [
|
var buttons = [
|
||||||
{text: this.egw.lang("Edit exception"), id: "exception", class: "ui-priority-primary", "default": true},
|
{text: this.egw.lang("Edit exception"), id: "exception", class: "ui-priority-primary", "default": true},
|
||||||
{text: this.egw.lang("Edit series"), id:"series"},
|
{text: this.egw.lang("Edit series"), id:"series"},
|
||||||
{text: this.egw.lang("Cancel"), id:"cancel"},
|
{text: this.egw.lang("Cancel"), id:"cancel"}
|
||||||
];
|
];
|
||||||
var callbackExceptionDialog = function (button_id)
|
et2_dialog.show_dialog(function(_button_id)
|
||||||
{
|
{
|
||||||
switch(button_id)
|
switch(_button_id)
|
||||||
{
|
{
|
||||||
case 'exception':
|
case 'exception':
|
||||||
that.open_edit(false);
|
that.egw.open(edit_id, 'calendar', 'edit', '&date='+edit_date);
|
||||||
|
that.open_edit.call(that, false);
|
||||||
break;
|
break;
|
||||||
case 'series':
|
case 'series':
|
||||||
that.open_edit(true);
|
that.egw.open(edit_id, 'calendar', 'edit', '&date='+edit_date+'&exception=1');
|
||||||
break;
|
break;
|
||||||
case 'cancel':
|
case 'cancel':
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
},this.egw.lang("Do you want to edit this event as an exception or the whole series?"),
|
||||||
|
this.egw.lang("This event is part of a series"), {}, buttons, et2_dialog.WARNING_MESSAGE);
|
||||||
}
|
}
|
||||||
var confirmExcDialog = et2_dialog.show_dialog(callbackExceptionDialog, this.egw.lang("Do you want to edit this event as an exception or the whole series?"),this.egw.lang("This event is part of a series"), {},buttons, et2_dialog.WARNING_MESSAGE);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* open calendar entry with the proper url either as series modifiction or exception modification
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
open_edit: function(series)
|
|
||||||
{
|
|
||||||
this.egw.open(calendar_edit_id,'calendar','edit','&date='+calendar_edit_date
|
|
||||||
+(!series?'&exception=1':''));
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
@ -133,7 +133,8 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
window.egw_LAB.script(include).wait(function(){
|
window.egw_LAB.script(include).wait(function()
|
||||||
|
{
|
||||||
// Make sure opener knows when we close - start a heartbeat
|
// Make sure opener knows when we close - start a heartbeat
|
||||||
if((popup || window.opener) && window.name != '')
|
if((popup || window.opener) && window.name != '')
|
||||||
{
|
{
|
||||||
@ -143,6 +144,14 @@
|
|||||||
}, 2000);
|
}, 2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// instanciate app object
|
||||||
|
var appname = window.egw_appName;
|
||||||
|
if (window.app && window.app[appname] != 'object' && typeof window.app.classes[appname] == 'function')
|
||||||
|
{
|
||||||
|
window.app[appname] = new window.app.classes[appname]();
|
||||||
|
}
|
||||||
|
|
||||||
|
// load et2
|
||||||
var data = egw_script.getAttribute('data-etemplate');
|
var data = egw_script.getAttribute('data-etemplate');
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user