diff --git a/addressbook/js/app.js b/addressbook/js/app.js
index 4bcda7fad5..350ae88ac5 100644
--- a/addressbook/js/app.js
+++ b/addressbook/js/app.js
@@ -258,7 +258,7 @@ app.addressbook = AppJS.extend(
add_new_list: function(owner)
{
- var name = window.prompt(egw.lang('Name for the distribution list'));
+ var name = window.prompt(this.egw.lang('Name for the distribution list'));
if (name)
{
egw.open('','addressbook', 'list', {
@@ -412,4 +412,4 @@ app.addressbook = AppJS.extend(
//Not implemented
},
-});
\ No newline at end of file
+});
diff --git a/filemanager/js/app.js b/filemanager/js/app.js
index 3e8823556c..76f2035df1 100644
--- a/filemanager/js/app.js
+++ b/filemanager/js/app.js
@@ -17,10 +17,6 @@
app.filemanager = AppJS.extend(
{
appname: 'filemanager',
- /**
- * et2 widget container
- */
- et2: null,
/**
* path widget
*/
@@ -71,7 +67,6 @@ app.filemanager = AppJS.extend(
// call parent
this._super.apply(this, arguments);
- this.et2 = et2.widgetContainer;
this.path_widget = this.et2.getWidgetById('path');
// get clipboard from browser localstore and update button tooltips
@@ -80,6 +75,12 @@ app.filemanager = AppJS.extend(
this.clipboard_files = JSON.parse(window.localStorage[this.clipboard_localstore_key]);
}
this.clipboard_tooltips();
+
+ if (typeof this.readonly != 'undefined')
+ {
+ this.set_readonly.apply(this, this.readonly);
+ delete this.readonly;
+ }
},
/**
@@ -215,9 +216,9 @@ app.filemanager = AppJS.extend(
if (_data.uploaded[file].confirm && !_data.uploaded[file].confirmed)
{
var buttons = [
- {text: egw.lang("Yes"), id: "overwrite", class: "ui-priority-primary", "default": true},
- {text: egw.lang("Rename"), id:"rename"},
- {text: egw.lang("Cancel"), id:"cancel"},
+ {text: this.egw.lang("Yes"), id: "overwrite", class: "ui-priority-primary", "default": true},
+ {text: this.egw.lang("Rename"), id:"rename"},
+ {text: this.egw.lang("Cancel"), id:"cancel"},
];
if (_data.uploaded[file].confirm === "is_dir")
buttons.shift();
@@ -240,9 +241,9 @@ app.filemanager = AppJS.extend(
}
},
_data.uploaded[file].confirm === "is_dir" ?
- egw.lang("There's already a directory with that name!") :
- egw.lang('Do you want to overwrite existing file %1 in directory %2?', _data.uploaded[file].name, _data.path),
- egw.lang('File %1 already exists', _data.uploaded[file].name),
+ this.egw.lang("There's already a directory with that name!") :
+ this.egw.lang('Do you want to overwrite existing file %1 in directory %2?', _data.uploaded[file].name, _data.path),
+ this.egw.lang('File %1 already exists', _data.uploaded[file].name),
_data.uploaded[file].name, buttons, file);
// setting required data for callback in as my_data
dialog.my_data = {
@@ -302,7 +303,7 @@ app.filemanager = AppJS.extend(
{
if (this.clipboard_files.length == 0)
{
- alert(egw.lang('Clipboard is empty!'));
+ alert(this.egw.lang('Clipboard is empty!'));
return;
}
switch(_type)
@@ -347,7 +348,7 @@ app.filemanager = AppJS.extend(
{
that._do_action(action_id, paths);
}
- }, _action.data.confirm, egw.lang('Confirmation required'), et2_dialog.BUTTONS_YES_NO, et2_dialog.QUESTION_MESSAGE);
+ }, _action.data.confirm, this.egw.lang('Confirmation required'), et2_dialog.BUTTONS_YES_NO, et2_dialog.QUESTION_MESSAGE);
}
else
{
@@ -360,7 +361,7 @@ app.filemanager = AppJS.extend(
*/
createdir: function()
{
- var dir = prompt(egw.lang('New directory'));
+ var dir = prompt(this.egw.lang('New directory'));
if (dir)
{
@@ -375,7 +376,7 @@ app.filemanager = AppJS.extend(
*/
symlink: function()
{
- var target = prompt(egw.lang('Link target'));
+ var target = prompt(this.egw.lang('Link target'));
if (target)
{
@@ -598,14 +599,14 @@ app.filemanager = AppJS.extend(
}
var text = $j(document.createElement('div')).css({left: '30px', position: 'absolute'});
// add filename or number of files for multiple files
- text.text(_elems.length > 1 ? _elems.length+' '+egw.lang('files') : this.basename(_elems[0].id));
+ text.text(_elems.length > 1 ? _elems.length+' '+this.egw.lang('files') : this.basename(_elems[0].id));
div.append(text);
// Add notice of Ctrl key, if supported
if(window.FileReader && 'draggable' in document.createElement('span') &&
navigator && navigator.userAgent.indexOf('Chrome') >= 0)
{
- text.append('
' + egw.lang('Hold Ctrl to drag files to your computer'));
+ text.append('
' + this.egw.lang('Hold Ctrl to drag files to your computer'));
}
return div;
},
@@ -621,8 +622,11 @@ app.filemanager = AppJS.extend(
set_readonly: function(_path, _ro)
{
//alert('set_readonly("'+_path+'", '+_ro+')');
- if(!this.path_widget) return;
-
+ if (!this.path_widget) // widget not yet ready, try later
+ {
+ this.readonly = [_path, _ro];
+ return;
+ }
var path = this.path_widget.getValue();
if (_path == path)
diff --git a/home/js/app.js b/home/js/app.js
index 63d9fecc49..a5f1e12283 100644
--- a/home/js/app.js
+++ b/home/js/app.js
@@ -360,7 +360,7 @@ app.home = AppJS.extend(
}
if(target_action == null)
{
- var link = et2_createWidget('link-entry', {label: egw.lang('Add')}, this.portlet_container);
+ var link = et2_createWidget('link-entry', {label: this.egw.lang('Add')}, this.portlet_container);
var dialog = et2_dialog.show_dialog(
function(button_id) {
if(button_id == et2_dialog.CANCEL_BUTTON) return;
@@ -380,7 +380,7 @@ app.home = AppJS.extend(
widget._process_edit(button_id,{list: new_list});
},
'Add',
- egw.lang('Add'), {},
+ this.egw.lang('Add'), {},
et2_dialog.BUTTONS_OK_CANCEL
);
dialog.set_message(link.getDOMNode());
diff --git a/infolog/js/app.js b/infolog/js/app.js
index c8ae0047c6..eca759ddda 100644
--- a/infolog/js/app.js
+++ b/infolog/js/app.js
@@ -149,7 +149,7 @@ app.infolog = AppJS.extend(
}
}
- var confirmDeleteDialog = et2_dialog.show_dialog(callbackDeleteDialog, egw.lang("Do you really want to DELETE this Rule"),egw.lang("Delete"), {},et2_dialog.BUTTONS_YES_NO_CANCEL, et2_dialog.WARNING_MESSAGE);
+ var confirmDeleteDialog = et2_dialog.show_dialog(callbackDeleteDialog, this.egw.lang("Do you really want to DELETE this Rule"),this.egw.lang("Delete"), {},et2_dialog.BUTTONS_YES_NO_CANCEL, et2_dialog.WARNING_MESSAGE);
},
diff --git a/mail/js/app.js b/mail/js/app.js
index cd91f4e3c9..26097bc7a0 100644
--- a/mail/js/app.js
+++ b/mail/js/app.js
@@ -8,6 +8,11 @@
* @version $Id$
*/
+/**
+ * UI for mail
+ *
+ * @augments AppJS
+ */
app.mail = AppJS.extend(
{
appname: 'mail',
@@ -358,7 +363,7 @@ app.mail = AppJS.extend(
if (typeof prefAskForMultipleForward == 'undefined') prefAskForMultipleForward = egw.preference('prefaskformultipleforward','mail');
if (cbAllMessages == true || cbAllVisibleMessages == true)
{
- Check = confirm(egw.lang('multiple forward of all mesages'));
+ Check = confirm(this.egw.lang('multiple forward of all mesages'));
alreadyAsked=true;
}
@@ -381,7 +386,7 @@ app.mail = AppJS.extend(
}
if (prefAskForMultipleForward == 1 && Check == true && alreadyAsked == false && sMessageList.length >0 && _messageList['msg'].length>1)
{
- askme = egw.lang('multipleforward');
+ askme = this.egw.lang('multipleforward');
//if (cbAllMessages == true || cbAllVisibleMessages == true) askme = egw_appWindow('felamimail').lang_confirm_all_messages; // not supported
Check = confirm(askme);
}
@@ -593,7 +598,7 @@ app.mail = AppJS.extend(
for (var i in _status)
{
// if olddesc is undefined or #skip# then skip the message, as we process subfolders
- if (typeof _status[i]['olddesc'] !== 'undefined' && _status[i]['olddesc'] !== '#skip-user-interaction-message#') app.mail.app_refresh(egw.lang("Renamed Folder %1 to %2",_status[i]['olddesc'],_status[i]['desc'], 'mail'));
+ if (typeof _status[i]['olddesc'] !== 'undefined' && _status[i]['olddesc'] !== '#skip-user-interaction-message#') app.mail.app_refresh(this.egw.lang("Renamed Folder %1 to %2",_status[i]['olddesc'],_status[i]['desc'], 'mail'));
ftree.renameItem(i,_status[i]['id'],_status[i]['desc']);
//alert(i +'->'+_status[i]['id']+'+'+_status[i]['desc']);
if (_status[i]['id']==selectedNode.id)
@@ -618,7 +623,7 @@ app.mail = AppJS.extend(
for (var i in _status)
{
// if olddesc is undefined or #skip# then skip the message, as we process subfolders
- if (typeof _status[i] !== 'undefined' && _status[i] !== '#skip-user-interaction-message#') app.mail.app_refresh(egw.lang("Removed Folder %1 ",_status[i], 'mail'));
+ if (typeof _status[i] !== 'undefined' && _status[i] !== '#skip-user-interaction-message#') app.mail.app_refresh(this.egw.lang("Removed Folder %1 ",_status[i], 'mail'));
ftree.deleteItem(i,(selectedNode.id==i));
var selectedNodeAfter = ftree.getSelectedNode();
//alert(i +'->'+_status[i]['id']+'+'+_status[i]['desc']);
@@ -644,7 +649,7 @@ app.mail = AppJS.extend(
for (var i in _status)
{
// if olddesc is undefined or #skip# then skip the message, as we process subfolders
- if (typeof _status[i] !== 'undefined' && _status[i] !== '#skip-user-interaction-message#') app.mail.app_refresh(egw.lang("Reloaded Folder %1 ",_status[i], 'mail'));
+ if (typeof _status[i] !== 'undefined' && _status[i] !== '#skip-user-interaction-message#') app.mail.app_refresh(this.egw.lang("Reloaded Folder %1 ",_status[i], 'mail'));
ftree.refreshItem(i);
var selectedNodeAfter = ftree.getSelectedNode();
//alert(i +'->'+_status[i]['id']+'+'+_status[i]['desc']);
@@ -758,7 +763,7 @@ app.mail = AppJS.extend(
}
var msg = this.mail_getFormData(_elems);
//alert(_action.id+','+ msg);
- app.mail.app_refresh(egw.lang('delete messages'), 'mail');
+ app.mail.app_refresh(this.egw.lang('delete messages'), 'mail');
if (!calledFromPopup) this.mail_setRowClass(_elems,'deleted');
this.mail_deleteMessages(msg,'no',calledFromPopup);
if (calledFromPopup && this.mail_isMainWindow==false) window.close();
@@ -772,7 +777,7 @@ app.mail = AppJS.extend(
*/
mail_deleteMessages: function(_msg,_action,_calledFromPopup)
{
- app.mail.app_refresh(egw.lang('delete messages'), 'mail');
+ app.mail.app_refresh(this.egw.lang('delete messages'), 'mail');
egw.json('mail.mail_ui.ajax_deleteMessages',[_msg,(typeof _action == 'undefined'?'no':_action)])
.sendRequest();
for (var i = 0; i < _msg['msg'].length; i++) egw.dataDeleteUID(_msg['msg'][i]);
@@ -797,7 +802,7 @@ app.mail = AppJS.extend(
}
else
{
- app.mail.app_refresh(egw.lang('canceled deletion due to userinteraction'), 'mail');
+ app.mail.app_refresh(this.egw.lang('canceled deletion due to userinteraction'), 'mail');
this.mail_removeRowClass(messageList,'deleted');
}
this.mail_refreshMessageGrid();
@@ -829,7 +834,7 @@ app.mail = AppJS.extend(
* mail_emptyTrash
*/
mail_emptyTrash: function() {
- app.mail.app_refresh(egw.lang('empty trash'), 'mail');
+ app.mail.app_refresh(this.egw.lang('empty trash'), 'mail');
egw.json('mail.mail_ui.ajax_emptyTrash')
.sendRequest(true);
},
@@ -838,7 +843,7 @@ app.mail = AppJS.extend(
* mail_compressFolder
*/
mail_compressFolder: function() {
- app.mail.app_refresh(egw.lang('compress folder'), 'mail');
+ app.mail.app_refresh(this.egw.lang('compress folder'), 'mail');
egw.json('mail.mail_ui.ajax_compressFolder')
.sendRequest(true);
},
@@ -864,7 +869,7 @@ app.mail = AppJS.extend(
*/
mail_changeFolder: function(folder,_widget) {
//alert('change Folder called:'+folder);
- app.mail.app_refresh(egw.lang('change folder')+'...', 'mail');
+ app.mail.app_refresh(this.egw.lang('change folder')+'...', 'mail');
var img = _widget.getSelectedNode().images[0]; // fetch first image
if (!(img.search(eval('/'+'NoSelect'+'/'))<0) || !(img.search(eval('/'+'thunderbird'+'/'))<0))
{
@@ -905,7 +910,7 @@ app.mail = AppJS.extend(
displayname = displayname.replace(/<\/b>/,"");
}
}
- myMsg = (displayname?displayname:folder)+' '+egw.lang('selected');
+ myMsg = (displayname?displayname:folder)+' '+this.egw.lang('selected');
app.mail.app_refresh(myMsg, 'mail');
}
//mail_refreshMessageGrid();// its done in refreshFolderStatus already
@@ -965,7 +970,7 @@ app.mail = AppJS.extend(
mail_flagMessages: function(_flag, _elems,_isPopup)
{
console.log(_flag, _elems);
- app.mail.app_refresh(egw.lang('flag messages'), 'mail');
+ app.mail.app_refresh(this.egw.lang('flag messages'), 'mail');
egw.json('mail.mail_ui.ajax_flagMessages',[_flag, _elems])
.sendRequest();
this.mail_refreshMessageGrid(_isPopup);
@@ -1292,12 +1297,12 @@ app.mail = AppJS.extend(
OldFolderName = OldFolderName.trim();
OldFolderName = OldFolderName.replace(/\([0-9]*\)/g,'').trim();
//console.log(OldFolderName);
- NewFolderName = prompt(egw.lang("Add a new Folder to %1:",OldFolderName));
+ NewFolderName = prompt(this.egw.lang("Add a new Folder to %1:",OldFolderName));
if (jQuery(NewFolderName).text().length>0) NewFolderName = jQuery(NewFolderName).text();
//alert(NewFolderName);
if (NewFolderName && NewFolderName.length>0)
{
- app.mail.app_refresh(egw.lang("Adding Folder %1 to %2",NewFolderName, OldFolderName, 'mail'));
+ app.mail.app_refresh(this.egw.lang("Adding Folder %1 to %2",NewFolderName, OldFolderName, 'mail'));
egw.json('mail.mail_ui.ajax_addFolder',[_senders[0].iface.id, NewFolderName])
.sendRequest(true);
}
@@ -1319,12 +1324,12 @@ app.mail = AppJS.extend(
OldFolderName = OldFolderName.trim();
OldFolderName = OldFolderName.replace(/\([0-9]*\)/g,'').trim();
//console.log(OldFolderName);
- NewFolderName = prompt(egw.lang("Rename Folder %1 to:",OldFolderName));
+ NewFolderName = prompt(this.egw.lang("Rename Folder %1 to:",OldFolderName));
if (jQuery(NewFolderName).text().length>0) NewFolderName = jQuery(NewFolderName).text();
//alert(NewFolderName);
if (NewFolderName && NewFolderName.length>0)
{
- app.mail.app_refresh(egw.lang("Renaming Folder %1 to %2",OldFolderName,NewFolderName, 'mail'));
+ app.mail.app_refresh(this.egw.lang("Renaming Folder %1 to %2",OldFolderName,NewFolderName, 'mail'));
egw.json('mail.mail_ui.ajax_renameFolder',[_senders[0].iface.id, NewFolderName])
.sendRequest(true);
}
@@ -1346,10 +1351,10 @@ app.mail = AppJS.extend(
OldFolderName = OldFolderName.trim();
OldFolderName = OldFolderName.replace(/\([0-9]*\)/g,'').trim();
//console.log(OldFolderName);
- reallyDelete = confirm(egw.lang("Do you really want to DELETE Folder %1 ? \r\nAll messages in the folder will be lost",OldFolderName));
+ reallyDelete = confirm(this.egw.lang("Do you really want to DELETE Folder %1 ? \r\nAll messages in the folder will be lost",OldFolderName));
if (reallyDelete)
{
- app.mail.app_refresh(egw.lang("Deleting Folder %1",OldFolderName, 'mail'));
+ app.mail.app_refresh(this.egw.lang("Deleting Folder %1",OldFolderName, 'mail'));
egw.json('mail.mail_ui.ajax_deleteFolder',[_senders[0].iface.id])
.sendRequest(true);
}
@@ -1487,7 +1492,7 @@ app.mail = AppJS.extend(
that._do_action(typeId, actionData['data'],ruleID);
}
}
- var confirmDeleteDialog = et2_dialog.show_dialog(callbackDeleteDialog, egw.lang("Do you really want to DELETE this Rule"),egw.lang("Delete"), {},et2_dialog.BUTTONS_YES_NO_CANCEL, et2_dialog.WARNING_MESSAGE);
+ var confirmDeleteDialog = et2_dialog.show_dialog(callbackDeleteDialog, this.egw.lang("Do you really want to DELETE this Rule"),this.egw.lang("Delete"), {},et2_dialog.BUTTONS_YES_NO_CANCEL, et2_dialog.WARNING_MESSAGE);
break;
case 'add' :
diff --git a/phpgwapi/js/jsapi/app_base.js b/phpgwapi/js/jsapi/app_base.js
index 793f45807b..3efe981b31 100644
--- a/phpgwapi/js/jsapi/app_base.js
+++ b/phpgwapi/js/jsapi/app_base.js
@@ -58,6 +58,11 @@ var AppJS = Class.extend({
* Internal reference to etemplate2 widget tree
*/
et2: null,
+
+ /**
+ * Internal reference to egw client-side api object for current app and window
+ */
+ egw: null,
/**
* Initialization and setup goes here, but the etemplate2 object
@@ -65,6 +70,8 @@ var AppJS = Class.extend({
*/
init: function() {
window.app[this.appname] = this;
+
+ this.egw = egw(this.appname, window);
},
/**