forked from extern/egroupware
split constructor function and place of instanciation for app.js objects: app[appname] = new app.classes[appname]();
This commit is contained in:
parent
f41480a3f6
commit
6d226a7921
@ -6,7 +6,7 @@
|
|||||||
* @author Hadi Nategh <hn-AT-stylite.de>
|
* @author Hadi Nategh <hn-AT-stylite.de>
|
||||||
* @copyright (c) 2008-13 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
* @copyright (c) 2008-13 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||||
* @version $id
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -14,7 +14,7 @@
|
|||||||
*
|
*
|
||||||
* @augments AppJS
|
* @augments AppJS
|
||||||
*/
|
*/
|
||||||
app.addressbook = AppJS.extend(
|
app.classes.addressbook = AppJS.extend(
|
||||||
{
|
{
|
||||||
appname: 'addressbook',
|
appname: 'addressbook',
|
||||||
/**
|
/**
|
||||||
|
@ -11,10 +11,10 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* UI for Admin
|
* UI for Admin
|
||||||
*
|
*
|
||||||
* @augments AppJS
|
* @augments AppJS
|
||||||
*/
|
*/
|
||||||
app.admin = AppJS.extend(
|
app.classes.admin = AppJS.extend(
|
||||||
{
|
{
|
||||||
appname: 'admin',
|
appname: 'admin',
|
||||||
/**
|
/**
|
||||||
@ -29,15 +29,15 @@ app.admin = AppJS.extend(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @memberOf app.filemanager
|
* @memberOf app.filemanager
|
||||||
*/
|
*/
|
||||||
init: function()
|
init: function()
|
||||||
{
|
{
|
||||||
// call parent
|
// call parent
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor
|
* Destructor
|
||||||
*/
|
*/
|
||||||
@ -46,7 +46,7 @@ app.admin = AppJS.extend(
|
|||||||
// call parent
|
// call parent
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is called when the etemplate2 object is loaded
|
* This function is called when the etemplate2 object is loaded
|
||||||
* and ready. If you must store a reference to the et2 object,
|
* and ready. If you must store a reference to the et2 object,
|
||||||
@ -60,7 +60,7 @@ app.admin = AppJS.extend(
|
|||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
|
|
||||||
var iframe = this.iframe = this.et2.getWidgetById('iframe');
|
var iframe = this.iframe = this.et2.getWidgetById('iframe');
|
||||||
if (iframe)
|
if (iframe)
|
||||||
{
|
{
|
||||||
var self = this;
|
var self = this;
|
||||||
jQuery(iframe.getDOMNode()).bind('load', function(){
|
jQuery(iframe.getDOMNode()).bind('load', function(){
|
||||||
@ -70,19 +70,19 @@ app.admin = AppJS.extend(
|
|||||||
}
|
}
|
||||||
this.splitter = this.et2.getWidgetById('splitter');
|
this.splitter = this.et2.getWidgetById('splitter');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hide navbar for idots template
|
* Hide navbar for idots template
|
||||||
*
|
*
|
||||||
* Just a hack for old idots, not neccesary for jdots
|
* Just a hack for old idots, not neccesary for jdots
|
||||||
*/
|
*/
|
||||||
_hide_navbar: function()
|
_hide_navbar: function()
|
||||||
{
|
{
|
||||||
var document = this.iframe.getDOMNode().contentDocument;
|
var document = this.iframe.getDOMNode().contentDocument;
|
||||||
|
|
||||||
// set white background, as transparent one lets account-list show through
|
// set white background, as transparent one lets account-list show through
|
||||||
document.getElementsByTagName('body')[0].style.backgroundColor = 'white';
|
document.getElementsByTagName('body')[0].style.backgroundColor = 'white';
|
||||||
|
|
||||||
// hide navbar elements
|
// hide navbar elements
|
||||||
var ids2hide = ['divLogo', 'topmenu', 'divAppIconBar', 'divStatusBar', 'tdSidebox', 'divAppboxHeader'];
|
var ids2hide = ['divLogo', 'topmenu', 'divAppIconBar', 'divStatusBar', 'tdSidebox', 'divAppboxHeader'];
|
||||||
for(var i=0; i < ids2hide.length; ++i)
|
for(var i=0; i < ids2hide.length; ++i)
|
||||||
@ -91,10 +91,10 @@ app.admin = AppJS.extend(
|
|||||||
if (elem) elem.style.display = 'none';
|
if (elem) elem.style.display = 'none';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set location of iframe for given _action and _sender (row)
|
* Set location of iframe for given _action and _sender (row)
|
||||||
*
|
*
|
||||||
* @param _action
|
* @param _action
|
||||||
* @param _senders
|
* @param _senders
|
||||||
*/
|
*/
|
||||||
@ -105,10 +105,10 @@ app.admin = AppJS.extend(
|
|||||||
|
|
||||||
this.iframe.set_src(url);
|
this.iframe.set_src(url);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Link hander for jDots template to just reload our iframe, instead of reloading whole admin app
|
* Link hander for jDots template to just reload our iframe, instead of reloading whole admin app
|
||||||
*
|
*
|
||||||
* @param _url
|
* @param _url
|
||||||
* @return boolean true, if linkHandler took care of link, false otherwise
|
* @return boolean true, if linkHandler took care of link, false otherwise
|
||||||
*/
|
*/
|
||||||
@ -128,17 +128,17 @@ app.admin = AppJS.extend(
|
|||||||
// can not load our own index page, has to be done by framework
|
// can not load our own index page, has to be done by framework
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run an admin module / onclick callback for tree
|
* Run an admin module / onclick callback for tree
|
||||||
*
|
*
|
||||||
* @param string _id id of clicked node
|
* @param string _id id of clicked node
|
||||||
* @param et2_tree _widget reference to tree widget
|
* @param et2_tree _widget reference to tree widget
|
||||||
*/
|
*/
|
||||||
run: function(_id, _widget)
|
run: function(_id, _widget)
|
||||||
{
|
{
|
||||||
var link = _widget.getUserData(_id, 'link');
|
var link = _widget.getUserData(_id, 'link');
|
||||||
|
|
||||||
if (_id == '/accounts' || _id.substr(0, 8) == '/groups/')
|
if (_id == '/accounts' || _id.substr(0, 8) == '/groups/')
|
||||||
{
|
{
|
||||||
this.splitter.undock();
|
this.splitter.undock();
|
||||||
@ -147,7 +147,7 @@ app.admin = AppJS.extend(
|
|||||||
}
|
}
|
||||||
else if (typeof link == 'undefined')
|
else if (typeof link == 'undefined')
|
||||||
{
|
{
|
||||||
_widget.openItem(_id, 'toggle');
|
_widget.openItem(_id, 'toggle');
|
||||||
}
|
}
|
||||||
else if (link[0] == '/' || link.substr(0,4) == 'http')
|
else if (link[0] == '/' || link.substr(0,4) == 'http')
|
||||||
{
|
{
|
||||||
@ -159,10 +159,10 @@ app.admin = AppJS.extend(
|
|||||||
eval(link.substr(11));
|
eval(link.substr(11));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* View, edit or delete a group callback for tree
|
* View, edit or delete a group callback for tree
|
||||||
*
|
*
|
||||||
* @param Object _action egwAction
|
* @param Object _action egwAction
|
||||||
* @param Object _senders egwActionObject _senders[0].id holds id
|
* @param Object _senders egwActionObject _senders[0].id holds id
|
||||||
*/
|
*/
|
||||||
@ -173,29 +173,29 @@ app.admin = AppJS.extend(
|
|||||||
case 'view':
|
case 'view':
|
||||||
this.run(_senders[0].id, this.et2.getWidgetById('tree'));
|
this.run(_senders[0].id, this.et2.getWidgetById('tree'));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'edit':
|
case 'edit':
|
||||||
case 'delete':
|
case 'delete':
|
||||||
this.splitter.dock();
|
this.splitter.dock();
|
||||||
this.iframe.set_src(egw.link('/index.php', {
|
this.iframe.set_src(egw.link('/index.php', {
|
||||||
menuaction: _action.id == 'edit' ? 'admin.uiaccounts.edit_group' : 'admin.uiaccounts.delete_group',
|
menuaction: _action.id == 'edit' ? 'admin.uiaccounts.edit_group' : 'admin.uiaccounts.delete_group',
|
||||||
account_id: _senders[0].id.split('/')[2]
|
account_id: _senders[0].id.split('/')[2]
|
||||||
}));
|
}));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'acl':
|
case 'acl':
|
||||||
this.splitter.dock();
|
this.splitter.dock();
|
||||||
this.iframe.set_src(egw.link('/index.php', {
|
this.iframe.set_src(egw.link('/index.php', {
|
||||||
menuaction: 'admin.admin_acl.index',
|
menuaction: 'admin.admin_acl.index',
|
||||||
account_id: _senders[0].id.split('/')[2]
|
account_id: _senders[0].id.split('/')[2]
|
||||||
}));
|
}));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modify an ACL entry
|
* Modify an ACL entry
|
||||||
*
|
*
|
||||||
* @param Object _action egwAction
|
* @param Object _action egwAction
|
||||||
* @param Object _senders egwActionObject _senders[0].id holds the id "admin::app:account:location"
|
* @param Object _senders egwActionObject _senders[0].id holds the id "admin::app:account:location"
|
||||||
*/
|
*/
|
||||||
@ -213,7 +213,7 @@ app.admin = AppJS.extend(
|
|||||||
var request = egw.json('admin_acl::ajax_change_acl', [ids], this._acl_callback,this,false,this)
|
var request = egw.json('admin_acl::ajax_change_acl', [ids], this._acl_callback,this,false,this)
|
||||||
.sendRequest();
|
.sendRequest();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'edit':
|
case 'edit':
|
||||||
// need to specify window to get correct opener, as admin has multiple windows open!
|
// need to specify window to get correct opener, as admin has multiple windows open!
|
||||||
egw('admin', window).open_link(egw.link('/index.php', {
|
egw('admin', window).open_link(egw.link('/index.php', {
|
||||||
@ -232,10 +232,10 @@ app.admin = AppJS.extend(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback called on successfull call of serverside ACL handling
|
* Callback called on successfull call of serverside ACL handling
|
||||||
*
|
*
|
||||||
* @param string _data returned from server
|
* @param string _data returned from server
|
||||||
*/
|
*/
|
||||||
_acl_callback: function(_data)
|
_acl_callback: function(_data)
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
*
|
*
|
||||||
* @augments AppJS
|
* @augments AppJS
|
||||||
*/
|
*/
|
||||||
app.calendar = AppJS.extend(
|
app.classes.calendar = AppJS.extend(
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* application name
|
* application name
|
||||||
|
@ -214,7 +214,13 @@ etemplate2.prototype.load = function(_name, _url, _data, _callback)
|
|||||||
// Initialize application js
|
// Initialize application js
|
||||||
var app_callback = null;
|
var app_callback = null;
|
||||||
// Only initialize once
|
// Only initialize once
|
||||||
if(typeof app[appname] == "function")
|
// new app class with constructor function in app.classes[appname]
|
||||||
|
if (typeof app[appname] !== 'object' && typeof app.classes[appname] == 'function')
|
||||||
|
{
|
||||||
|
app[appname] = new app.classes[appname]();
|
||||||
|
}
|
||||||
|
// old app class with constructor function in app[appname] (deprecated)
|
||||||
|
else if(typeof app[appname] == "function")
|
||||||
{
|
{
|
||||||
(function() { new app[appname]();}).call();
|
(function() { new app[appname]();}).call();
|
||||||
}
|
}
|
||||||
|
@ -11,10 +11,10 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* UI for filemanager
|
* UI for filemanager
|
||||||
*
|
*
|
||||||
* @augments AppJS
|
* @augments AppJS
|
||||||
*/
|
*/
|
||||||
app.filemanager = AppJS.extend(
|
app.classes.filemanager = AppJS.extend(
|
||||||
{
|
{
|
||||||
appname: 'filemanager',
|
appname: 'filemanager',
|
||||||
/**
|
/**
|
||||||
@ -36,15 +36,15 @@ app.filemanager = AppJS.extend(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @memberOf app.filemanager
|
* @memberOf app.filemanager
|
||||||
*/
|
*/
|
||||||
init: function()
|
init: function()
|
||||||
{
|
{
|
||||||
// call parent
|
// call parent
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor
|
* Destructor
|
||||||
*/
|
*/
|
||||||
@ -54,7 +54,7 @@ app.filemanager = AppJS.extend(
|
|||||||
// call parent
|
// call parent
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is called when the etemplate2 object is loaded
|
* This function is called when the etemplate2 object is loaded
|
||||||
* and ready. If you must store a reference to the et2 object,
|
* and ready. If you must store a reference to the et2 object,
|
||||||
@ -68,28 +68,28 @@ app.filemanager = AppJS.extend(
|
|||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
|
|
||||||
this.path_widget = this.et2.getWidgetById('path');
|
this.path_widget = this.et2.getWidgetById('path');
|
||||||
|
|
||||||
// get clipboard from browser localstore and update button tooltips
|
// get clipboard from browser localstore and update button tooltips
|
||||||
if (typeof window.localStorage != 'undefined' && typeof window.localStorage[this.clipboard_localstore_key] != 'undefined')
|
if (typeof window.localStorage != 'undefined' && typeof window.localStorage[this.clipboard_localstore_key] != 'undefined')
|
||||||
{
|
{
|
||||||
this.clipboard_files = JSON.parse(window.localStorage[this.clipboard_localstore_key]);
|
this.clipboard_files = JSON.parse(window.localStorage[this.clipboard_localstore_key]);
|
||||||
}
|
}
|
||||||
this.clipboard_tooltips();
|
this.clipboard_tooltips();
|
||||||
|
|
||||||
if (typeof this.readonly != 'undefined')
|
if (typeof this.readonly != 'undefined')
|
||||||
{
|
{
|
||||||
this.set_readonly.apply(this, this.readonly);
|
this.set_readonly.apply(this, this.readonly);
|
||||||
delete this.readonly;
|
delete this.readonly;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Regexp to convert id to a path, use this.id2path(_id)
|
* Regexp to convert id to a path, use this.id2path(_id)
|
||||||
*/
|
*/
|
||||||
remove_prefix: /^filemanager::/,
|
remove_prefix: /^filemanager::/,
|
||||||
/**
|
/**
|
||||||
* Convert id to path (remove "filemanager::" prefix)
|
* Convert id to path (remove "filemanager::" prefix)
|
||||||
*
|
*
|
||||||
* @param string _id
|
* @param string _id
|
||||||
* @returns string
|
* @returns string
|
||||||
*/
|
*/
|
||||||
@ -100,7 +100,7 @@ app.filemanager = AppJS.extend(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert array of elems to array of paths
|
* Convert array of elems to array of paths
|
||||||
*
|
*
|
||||||
* @param array _elems selected items from actions
|
* @param array _elems selected items from actions
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
@ -113,10 +113,10 @@ app.filemanager = AppJS.extend(
|
|||||||
}
|
}
|
||||||
return paths;
|
return paths;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get directory of a path
|
* Get directory of a path
|
||||||
*
|
*
|
||||||
* @param string _path
|
* @param string _path
|
||||||
* @returns string
|
* @returns string
|
||||||
*/
|
*/
|
||||||
@ -126,10 +126,10 @@ app.filemanager = AppJS.extend(
|
|||||||
parts.pop();
|
parts.pop();
|
||||||
return parts.join('/') || '/';
|
return parts.join('/') || '/';
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get name of a path
|
* Get name of a path
|
||||||
*
|
*
|
||||||
* @param string _path
|
* @param string _path
|
||||||
* @returns string
|
* @returns string
|
||||||
*/
|
*/
|
||||||
@ -137,20 +137,20 @@ app.filemanager = AppJS.extend(
|
|||||||
{
|
{
|
||||||
return _path.split('/').pop();
|
return _path.split('/').pop();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get current working directory
|
* Get current working directory
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
get_path: function()
|
get_path: function()
|
||||||
{
|
{
|
||||||
return this.path_widget ? this.path_widget.get_value() : null;
|
return this.path_widget ? this.path_widget.get_value() : null;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open compose with already attached files
|
* Open compose with already attached files
|
||||||
*
|
*
|
||||||
* @param string|array attachment path(s)
|
* @param string|array attachment path(s)
|
||||||
*/
|
*/
|
||||||
open_mail: function(attachments)
|
open_mail: function(attachments)
|
||||||
@ -164,10 +164,10 @@ app.filemanager = AppJS.extend(
|
|||||||
}
|
}
|
||||||
egw.open('', 'felamimail', 'add', params);
|
egw.open('', 'felamimail', 'add', params);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mail files action: open compose with already attached files
|
* Mail files action: open compose with already attached files
|
||||||
*
|
*
|
||||||
* @param _action
|
* @param _action
|
||||||
* @param _elems
|
* @param _elems
|
||||||
*/
|
*/
|
||||||
@ -178,7 +178,7 @@ app.filemanager = AppJS.extend(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Send names of uploaded files (again) to server, to process them: either copy to vfs or ask overwrite/rename
|
* Send names of uploaded files (again) to server, to process them: either copy to vfs or ask overwrite/rename
|
||||||
*
|
*
|
||||||
* @param _event
|
* @param _event
|
||||||
* @param _file_count
|
* @param _file_count
|
||||||
* @param {string} [_path=current directory] Where the file is uploaded to.
|
* @param {string} [_path=current directory] Where the file is uploaded to.
|
||||||
@ -192,18 +192,18 @@ app.filemanager = AppJS.extend(
|
|||||||
if (_file_count && !jQuery.isEmptyObject(_event.data.getValue()))
|
if (_file_count && !jQuery.isEmptyObject(_event.data.getValue()))
|
||||||
{
|
{
|
||||||
var widget = _event.data;
|
var widget = _event.data;
|
||||||
var request = egw.json('filemanager_ui::ajax_action', ['upload', widget.getValue(), _path],
|
var request = egw.json('filemanager_ui::ajax_action', ['upload', widget.getValue(), _path],
|
||||||
this._upload_callback, this, true, this
|
this._upload_callback, this, true, this
|
||||||
).sendRequest();
|
).sendRequest();
|
||||||
widget.set_value('');
|
widget.set_value('');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback for server response to upload request:
|
* Callback for server response to upload request:
|
||||||
* - display message and refresh list
|
* - display message and refresh list
|
||||||
* - ask use to confirm overwritting existing files or rename upload
|
* - ask use to confirm overwritting existing files or rename upload
|
||||||
*
|
*
|
||||||
* @param object _data values for attributes msg, files, ...
|
* @param object _data values for attributes msg, files, ...
|
||||||
*/
|
*/
|
||||||
_upload_callback: function(_data)
|
_upload_callback: function(_data)
|
||||||
@ -254,7 +254,7 @@ app.filemanager = AppJS.extend(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update clickboard tooltips in buttons
|
* Update clickboard tooltips in buttons
|
||||||
*/
|
*/
|
||||||
@ -267,10 +267,10 @@ app.filemanager = AppJS.extend(
|
|||||||
if (button) button.set_statustext(this.clipboard_files.join(",\n"));
|
if (button) button.set_statustext(this.clipboard_files.join(",\n"));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clip files into clipboard
|
* Clip files into clipboard
|
||||||
*
|
*
|
||||||
* @param _action
|
* @param _action
|
||||||
* @param _elems
|
* @param _elems
|
||||||
*/
|
*/
|
||||||
@ -278,25 +278,25 @@ app.filemanager = AppJS.extend(
|
|||||||
{
|
{
|
||||||
this.clipboard_is_cut = _action.id == "cut";
|
this.clipboard_is_cut = _action.id == "cut";
|
||||||
if (_action.id != "add") this.clipboard_files = [];
|
if (_action.id != "add") this.clipboard_files = [];
|
||||||
|
|
||||||
this.clipboard_files = this.clipboard_files.concat(this._elems2paths(_elems));
|
this.clipboard_files = this.clipboard_files.concat(this._elems2paths(_elems));
|
||||||
|
|
||||||
if (_action.id == "add" && this.clipboard_files.length > 1)
|
if (_action.id == "add" && this.clipboard_files.length > 1)
|
||||||
{
|
{
|
||||||
// ToDo: make sure files are unique
|
// ToDo: make sure files are unique
|
||||||
}
|
}
|
||||||
this.clipboard_tooltips();
|
this.clipboard_tooltips();
|
||||||
|
|
||||||
// update localstore with files
|
// update localstore with files
|
||||||
if (typeof window.localStorage != 'undefined')
|
if (typeof window.localStorage != 'undefined')
|
||||||
{
|
{
|
||||||
window.localStorage[this.clipboard_localstore_key] = JSON.stringify(this.clipboard_files);
|
window.localStorage[this.clipboard_localstore_key] = JSON.stringify(this.clipboard_files);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Paste files into current directory or mail them
|
* Paste files into current directory or mail them
|
||||||
*
|
*
|
||||||
* @param _type 'paste', 'linkpaste', 'mailpaste'
|
* @param _type 'paste', 'linkpaste', 'mailpaste'
|
||||||
*/
|
*/
|
||||||
paste: function(_type)
|
paste: function(_type)
|
||||||
@ -311,7 +311,7 @@ app.filemanager = AppJS.extend(
|
|||||||
case 'mailpaste':
|
case 'mailpaste':
|
||||||
this.open_mail(this.clipboard_files);
|
this.open_mail(this.clipboard_files);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'paste':
|
case 'paste':
|
||||||
this._do_action(this.clipboard_is_cut ? 'move' : 'copy', this.clipboard_files);
|
this._do_action(this.clipboard_is_cut ? 'move' : 'copy', this.clipboard_files);
|
||||||
|
|
||||||
@ -322,7 +322,7 @@ app.filemanager = AppJS.extend(
|
|||||||
this.clipboard_tooltips();
|
this.clipboard_tooltips();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'linkpaste':
|
case 'linkpaste':
|
||||||
this._do_action('symlink', this.clipboard_files);
|
this._do_action('symlink', this.clipboard_files);
|
||||||
break;
|
break;
|
||||||
@ -331,7 +331,7 @@ app.filemanager = AppJS.extend(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Pass action to server
|
* Pass action to server
|
||||||
*
|
*
|
||||||
* @param _action
|
* @param _action
|
||||||
* @param _elems
|
* @param _elems
|
||||||
*/
|
*/
|
||||||
@ -346,16 +346,16 @@ app.filemanager = AppJS.extend(
|
|||||||
{
|
{
|
||||||
if (button_id != et2_dialog.NO_BUTTON)
|
if (button_id != et2_dialog.NO_BUTTON)
|
||||||
{
|
{
|
||||||
that._do_action(action_id, paths);
|
that._do_action(action_id, paths);
|
||||||
}
|
}
|
||||||
}, _action.data.confirm, this.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
|
else
|
||||||
{
|
{
|
||||||
this._do_action(_action.id, paths);
|
this._do_action(_action.id, paths);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prompt user for directory to create
|
* Prompt user for directory to create
|
||||||
*/
|
*/
|
||||||
@ -370,7 +370,7 @@ app.filemanager = AppJS.extend(
|
|||||||
this.change_dir(path+'/'+dir);
|
this.change_dir(path+'/'+dir);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prompt user for directory to create
|
* Prompt user for directory to create
|
||||||
*/
|
*/
|
||||||
@ -383,10 +383,10 @@ app.filemanager = AppJS.extend(
|
|||||||
this._do_action('symlink', target);
|
this._do_action('symlink', target);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run a serverside action via an ajax call
|
* Run a serverside action via an ajax call
|
||||||
*
|
*
|
||||||
* @param _type 'move_file', 'copy_file', ...
|
* @param _type 'move_file', 'copy_file', ...
|
||||||
* @param _selected selected paths
|
* @param _selected selected paths
|
||||||
* @param _sync send a synchronous ajax request
|
* @param _sync send a synchronous ajax request
|
||||||
@ -399,20 +399,20 @@ app.filemanager = AppJS.extend(
|
|||||||
this._do_action_callback, this, !_sync, this
|
this._do_action_callback, this, !_sync, this
|
||||||
).sendRequest();
|
).sendRequest();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback for _do_action ajax call
|
* Callback for _do_action ajax call
|
||||||
*
|
*
|
||||||
* @param _data
|
* @param _data
|
||||||
*/
|
*/
|
||||||
_do_action_callback: function(_data)
|
_do_action_callback: function(_data)
|
||||||
{
|
{
|
||||||
window.egw_refresh(_data.msg, this.appname);
|
window.egw_refresh(_data.msg, this.appname);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Force download of a file by appending '?download' to it's download url
|
* Force download of a file by appending '?download' to it's download url
|
||||||
*
|
*
|
||||||
* @param _action
|
* @param _action
|
||||||
* @param _senders
|
* @param _senders
|
||||||
*/
|
*/
|
||||||
@ -423,10 +423,10 @@ app.filemanager = AppJS.extend(
|
|||||||
if (url[0] == '/') url = egw.link(url);
|
if (url[0] == '/') url = egw.link(url);
|
||||||
window.location = url+"?download";
|
window.location = url+"?download";
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change directory
|
* Change directory
|
||||||
*
|
*
|
||||||
* @param _dir directory to change to incl. '..' for one up
|
* @param _dir directory to change to incl. '..' for one up
|
||||||
*/
|
*/
|
||||||
change_dir: function(_dir)
|
change_dir: function(_dir)
|
||||||
@ -442,10 +442,10 @@ app.filemanager = AppJS.extend(
|
|||||||
}
|
}
|
||||||
this.path_widget.set_value(_dir);
|
this.path_widget.set_value(_dir);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open/active an item
|
* Open/active an item
|
||||||
*
|
*
|
||||||
* @param _action
|
* @param _action
|
||||||
* @param _senders
|
* @param _senders
|
||||||
*/
|
*/
|
||||||
@ -463,10 +463,10 @@ app.filemanager = AppJS.extend(
|
|||||||
egw.open({path: path, type: data.data.mime}, 'file');
|
egw.open({path: path, type: data.data.mime}, 'file');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit prefs of current directory
|
* Edit prefs of current directory
|
||||||
*
|
*
|
||||||
* @param _action
|
* @param _action
|
||||||
* @param _senders
|
* @param _senders
|
||||||
*/
|
*/
|
||||||
@ -479,10 +479,10 @@ app.filemanager = AppJS.extend(
|
|||||||
path: path,
|
path: path,
|
||||||
}), 'fileprefs', '495x425');
|
}), 'fileprefs', '495x425');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File(s) droped
|
* File(s) droped
|
||||||
*
|
*
|
||||||
* @param _action
|
* @param _action
|
||||||
* @param _elems
|
* @param _elems
|
||||||
* @param _target
|
* @param _target
|
||||||
@ -493,7 +493,7 @@ app.filemanager = AppJS.extend(
|
|||||||
var src = this._elems2paths(_elems);
|
var src = this._elems2paths(_elems);
|
||||||
var dst = this.id2path(_target.id);
|
var dst = this.id2path(_target.id);
|
||||||
//alert(_action.id+': '+src.join(', ')+' --> '+dst);
|
//alert(_action.id+': '+src.join(', ')+' --> '+dst);
|
||||||
|
|
||||||
// check if target is a file --> use it's directory instead
|
// check if target is a file --> use it's directory instead
|
||||||
var data = egw.dataGetUIDdata(_target.id);
|
var data = egw.dataGetUIDdata(_target.id);
|
||||||
if (data.data.mime != 'httpd/unix-directory')
|
if (data.data.mime != 'httpd/unix-directory')
|
||||||
@ -503,12 +503,12 @@ app.filemanager = AppJS.extend(
|
|||||||
|
|
||||||
this._do_action(_action.id == "file_drop_move" ? 'move' : 'copy', src, false, dst);
|
this._do_action(_action.id == "file_drop_move" ? 'move' : 'copy', src, false, dst);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle a native / HTML5 file drop from system
|
* Handle a native / HTML5 file drop from system
|
||||||
*
|
*
|
||||||
* This is a callback from nextmatch to prevent the default link action, and just upload instead.
|
* This is a callback from nextmatch to prevent the default link action, and just upload instead.
|
||||||
*
|
*
|
||||||
* @param {string} row_uid UID of the row the files were dropped on
|
* @param {string} row_uid UID of the row the files were dropped on
|
||||||
* @param {File[]} Array of Files
|
* @param {File[]} Array of Files
|
||||||
*/
|
*/
|
||||||
@ -516,27 +516,27 @@ app.filemanager = AppJS.extend(
|
|||||||
{
|
{
|
||||||
var self = this;
|
var self = this;
|
||||||
var data = egw.dataGetUIDdata(row_uid);
|
var data = egw.dataGetUIDdata(row_uid);
|
||||||
|
|
||||||
var path = data.data.mime == "httpd/unix-directory" ? data.data.path : this.get_path();
|
var path = data.data.mime == "httpd/unix-directory" ? data.data.path : this.get_path();
|
||||||
var widget = this.et2.getWidgetById('upload');
|
var widget = this.et2.getWidgetById('upload');
|
||||||
|
|
||||||
// Override finish to specify a potentially different path
|
// Override finish to specify a potentially different path
|
||||||
var old_onfinish = widget.options.onFinish;
|
var old_onfinish = widget.options.onFinish;
|
||||||
|
|
||||||
widget.options.onFinish = function(_event, _file_count) {
|
widget.options.onFinish = function(_event, _file_count) {
|
||||||
widget.options.onFinish = old_onfinish;
|
widget.options.onFinish = old_onfinish;
|
||||||
self.upload(_event, _file_count, path);
|
self.upload(_event, _file_count, path);
|
||||||
}
|
}
|
||||||
// This triggers the upload
|
// This triggers the upload
|
||||||
widget.set_value(files);
|
widget.set_value(files);
|
||||||
|
|
||||||
// Return false to prevent the link
|
// Return false to prevent the link
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get drag helper, called on drag start
|
* Get drag helper, called on drag start
|
||||||
*
|
*
|
||||||
* @param _action
|
* @param _action
|
||||||
* @param _elems
|
* @param _elems
|
||||||
* @return some dome objects
|
* @return some dome objects
|
||||||
@ -582,10 +582,10 @@ app.filemanager = AppJS.extend(
|
|||||||
// Create a stack of images
|
// Create a stack of images
|
||||||
var img = $j(document.createElement('img'));
|
var img = $j(document.createElement('img'));
|
||||||
img.css({
|
img.css({
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
'z-index': 10000-i,
|
'z-index': 10000-i,
|
||||||
top: idx*5,
|
top: idx*5,
|
||||||
left: idx*5,
|
left: idx*5,
|
||||||
opacity: (maxCnt - idx) / maxCnt
|
opacity: (maxCnt - idx) / maxCnt
|
||||||
});
|
});
|
||||||
img.attr('src', icons[i]);
|
img.attr('src', icons[i]);
|
||||||
@ -604,19 +604,19 @@ app.filemanager = AppJS.extend(
|
|||||||
div.append(text);
|
div.append(text);
|
||||||
|
|
||||||
// Add notice of Ctrl key, if supported
|
// Add notice of Ctrl key, if supported
|
||||||
if(window.FileReader && 'draggable' in document.createElement('span') &&
|
if(window.FileReader && 'draggable' in document.createElement('span') &&
|
||||||
navigator && navigator.userAgent.indexOf('Chrome') >= 0)
|
navigator && navigator.userAgent.indexOf('Chrome') >= 0)
|
||||||
{
|
{
|
||||||
text.append('<br />' + this.egw.lang('Hold Ctrl to drag files to your computer'));
|
text.append('<br />' + this.egw.lang('Hold Ctrl to drag files to your computer'));
|
||||||
}
|
}
|
||||||
return div;
|
return div;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change readonly state for given directory
|
* Change readonly state for given directory
|
||||||
*
|
*
|
||||||
* I get call/transported with each get_rows call, but should only by applied to UI if matching curent dir
|
* I get call/transported with each get_rows call, but should only by applied to UI if matching curent dir
|
||||||
*
|
*
|
||||||
* @param _path
|
* @param _path
|
||||||
* @param _ro
|
* @param _ro
|
||||||
*/
|
*/
|
||||||
@ -629,14 +629,14 @@ app.filemanager = AppJS.extend(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var path = this.path_widget.getValue();
|
var path = this.path_widget.getValue();
|
||||||
|
|
||||||
if (_path == path)
|
if (_path == path)
|
||||||
{
|
{
|
||||||
var ids = ['button[linkpaste]', 'button[paste]', 'button[createdir]', 'button[symlink]', 'upload'];
|
var ids = ['button[linkpaste]', 'button[paste]', 'button[createdir]', 'button[symlink]', 'upload'];
|
||||||
for(var i=0; i < ids.length; ++i)
|
for(var i=0; i < ids.length; ++i)
|
||||||
{
|
{
|
||||||
var widget = this.et2.getWidgetById(ids[i]);
|
var widget = this.et2.getWidgetById(ids[i]);
|
||||||
if (widget)
|
if (widget)
|
||||||
{
|
{
|
||||||
if (widget._type == 'button' || widget._type == 'buttononly')
|
if (widget._type == 'button' || widget._type == 'buttononly')
|
||||||
{
|
{
|
||||||
@ -650,7 +650,7 @@ app.filemanager = AppJS.extend(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Functions for the select dialog
|
* Functions for the select dialog
|
||||||
*/
|
*/
|
||||||
@ -672,7 +672,7 @@ app.filemanager = AppJS.extend(
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
select_show: function(file)
|
select_show: function(file)
|
||||||
{
|
{
|
||||||
var editfield = this.et2.getWidgetById('name');
|
var editfield = this.et2.getWidgetById('name');
|
||||||
|
@ -19,15 +19,15 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* JS for home application
|
* JS for home application
|
||||||
*
|
*
|
||||||
* Home is a collection of little bits of content (portlets) from the other applications.
|
* Home is a collection of little bits of content (portlets) from the other applications.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Uses Gridster for the grid layout
|
* Uses Gridster for the grid layout
|
||||||
* @see http://gridster.net
|
* @see http://gridster.net
|
||||||
* @augments AppJS
|
* @augments AppJS
|
||||||
*/
|
*/
|
||||||
app.home = AppJS.extend(
|
app.classes.home = AppJS.extend(
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* AppJS requires overwriting this with the actual application name
|
* AppJS requires overwriting this with the actual application name
|
||||||
@ -49,7 +49,7 @@ app.home = AppJS.extend(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @memberOf app.home
|
* @memberOf app.home
|
||||||
*/
|
*/
|
||||||
init: function()
|
init: function()
|
||||||
@ -84,7 +84,7 @@ app.home = AppJS.extend(
|
|||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
|
|
||||||
this.portlet_container = this.et2.getWidgetById("portlets");
|
this.portlet_container = this.et2.getWidgetById("portlets");
|
||||||
|
|
||||||
// Don't do twice
|
// Don't do twice
|
||||||
if(this.portlet_container._children.length > 0) return;
|
if(this.portlet_container._children.length > 0) return;
|
||||||
|
|
||||||
@ -226,11 +226,11 @@ app.home = AppJS.extend(
|
|||||||
* @return Object - will be returned by gridster.serialize()
|
* @return Object - will be returned by gridster.serialize()
|
||||||
*/
|
*/
|
||||||
serialize_params: function($w, grid) {
|
serialize_params: function($w, grid) {
|
||||||
return {
|
return {
|
||||||
id: $w.attr("id"),
|
id: $w.attr("id"),
|
||||||
row: grid.row,
|
row: grid.row,
|
||||||
col: grid.col,
|
col: grid.col,
|
||||||
width: grid.width,
|
width: grid.width,
|
||||||
height: grid.height
|
height: grid.height
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -296,7 +296,7 @@ app.home = AppJS.extend(
|
|||||||
List:
|
List:
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* List uses mostly JS to generate its content, so we just do it on the JS side by
|
* List uses mostly JS to generate its content, so we just do it on the JS side by
|
||||||
* returning a call to this function as the HTML content.
|
* returning a call to this function as the HTML content.
|
||||||
*
|
*
|
||||||
* @param id String The ID of the portlet
|
* @param id String The ID of the portlet
|
||||||
@ -318,7 +318,7 @@ app.home = AppJS.extend(
|
|||||||
// List was just rudely pulled from DOM by the call to HTML, put it back
|
// List was just rudely pulled from DOM by the call to HTML, put it back
|
||||||
portlet.content.append(list.getDOMNode());
|
portlet.content.append(list.getDOMNode());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Create widget
|
// Create widget
|
||||||
list = et2_createWidget('link-list', {id: id+'-list'}, portlet);
|
list = et2_createWidget('link-list', {id: id+'-list'}, portlet);
|
||||||
@ -375,7 +375,7 @@ app.home = AppJS.extend(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
new_list.push(add);
|
new_list.push(add);
|
||||||
widget._process_edit(button_id,{list: new_list});
|
widget._process_edit(button_id,{list: new_list});
|
||||||
},
|
},
|
||||||
@ -394,7 +394,7 @@ app.home = AppJS.extend(
|
|||||||
if(source[i].id) drop_data.push(source[i].id);
|
if(source[i].id) drop_data.push(source[i].id);
|
||||||
}
|
}
|
||||||
widget._process_edit(et2_dialog.BUTTONS_OK_CANCEL,{
|
widget._process_edit(et2_dialog.BUTTONS_OK_CANCEL,{
|
||||||
list: widget.options.settings.list || {},
|
list: widget.options.settings.list || {},
|
||||||
dropped_data: drop_data
|
dropped_data: drop_data
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,10 @@
|
|||||||
*
|
*
|
||||||
* @augments AppJS
|
* @augments AppJS
|
||||||
*/
|
*/
|
||||||
app.importexport = AppJS.extend(
|
app.classes.importexport = AppJS.extend(
|
||||||
{
|
{
|
||||||
appname: 'importexport',
|
appname: 'importexport',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -37,7 +37,7 @@ app.importexport = AppJS.extend(
|
|||||||
// call parent
|
// call parent
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is called when the etemplate2 object is loaded
|
* This function is called when the etemplate2 object is loaded
|
||||||
* and ready. If you must store a reference to the et2 object,
|
* and ready. If you must store a reference to the et2 object,
|
||||||
@ -49,7 +49,7 @@ app.importexport = AppJS.extend(
|
|||||||
{
|
{
|
||||||
// call parent
|
// call parent
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
|
|
||||||
if(this.et2.getWidgetById('export') && !this.et2.getArrayMgr("content").getEntry("definition"))
|
if(this.et2.getWidgetById('export') && !this.et2.getArrayMgr("content").getEntry("definition"))
|
||||||
{
|
{
|
||||||
// et2 doesn't understand a disabled button in the normal sense
|
// et2 doesn't understand a disabled button in the normal sense
|
||||||
@ -57,12 +57,12 @@ app.importexport = AppJS.extend(
|
|||||||
$j(this.et2.getWidgetById('preview').getDOMNode()).attr('disabled','disabled');
|
$j(this.et2.getWidgetById('preview').getDOMNode()).attr('disabled','disabled');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
export_preview: function(event, widget)
|
export_preview: function(event, widget)
|
||||||
{
|
{
|
||||||
var preview = $j(widget.getRoot().getWidgetById('preview_box').getDOMNode());
|
var preview = $j(widget.getRoot().getWidgetById('preview_box').getDOMNode());
|
||||||
$j('.content',preview).empty();
|
$j('.content',preview).empty();
|
||||||
|
|
||||||
preview
|
preview
|
||||||
.addClass('loading')
|
.addClass('loading')
|
||||||
.show(100, jQuery.proxy(function() {
|
.show(100, jQuery.proxy(function() {
|
||||||
@ -74,12 +74,12 @@ app.importexport = AppJS.extend(
|
|||||||
},this));
|
},this));
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
import_preview: function(event, widget)
|
import_preview: function(event, widget)
|
||||||
{
|
{
|
||||||
var test = widget.getRoot().getWidgetById('dry-run');
|
var test = widget.getRoot().getWidgetById('dry-run');
|
||||||
if(!test.getValue()) return true;
|
if(!test.getValue()) return true;
|
||||||
|
|
||||||
// Show preview
|
// Show preview
|
||||||
var preview = $j(widget.getRoot().getWidgetById('preview_box').getDOMNode());
|
var preview = $j(widget.getRoot().getWidgetById('preview_box').getDOMNode());
|
||||||
$j('.content',preview).empty();
|
$j('.content',preview).empty();
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @author Hadi Nategh <hn-AT-stylite.de>
|
* @author Hadi Nategh <hn-AT-stylite.de>
|
||||||
* @copyright (c) 2008-13 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
* @copyright (c) 2008-13 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||||
* @version
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -14,7 +14,7 @@
|
|||||||
*
|
*
|
||||||
* @augments AppJS
|
* @augments AppJS
|
||||||
*/
|
*/
|
||||||
app.infolog = AppJS.extend(
|
app.classes.infolog = AppJS.extend(
|
||||||
{
|
{
|
||||||
appname: 'infolog',
|
appname: 'infolog',
|
||||||
/**
|
/**
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
*
|
*
|
||||||
* @augments AppJS
|
* @augments AppJS
|
||||||
*/
|
*/
|
||||||
app.mail = AppJS.extend(
|
app.classes.mail = AppJS.extend(
|
||||||
{
|
{
|
||||||
appname: 'mail',
|
appname: 'mail',
|
||||||
|
|
||||||
|
@ -15,14 +15,26 @@
|
|||||||
egw_inheritance;
|
egw_inheritance;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
window.app = {};
|
/**
|
||||||
|
* Object to collect instanciated appliction objects
|
||||||
|
*
|
||||||
|
* Attributes classes collects loaded application classes,
|
||||||
|
* which can get instanciated:
|
||||||
|
*
|
||||||
|
* app[appname] = new app.classes[appname]();
|
||||||
|
*
|
||||||
|
* On destruction only app[appname] gets deleted, app.classes[appname] need to be used again!
|
||||||
|
*
|
||||||
|
* @type object
|
||||||
|
*/
|
||||||
|
window.app = {classes: {}};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Common base class for application javascript
|
* Common base class for application javascript
|
||||||
* Each app should extend as needed.
|
* Each app should extend as needed.
|
||||||
*
|
*
|
||||||
* All application javascript should be inside. Intitialization goes in init(),
|
* All application javascript should be inside. Intitialization goes in init(),
|
||||||
* clean-up code goes in destroy(). Initialization is done once all js is loaded.
|
* clean-up code goes in destroy(). Initialization is done once all js is loaded.
|
||||||
*
|
*
|
||||||
* var app.appname = AppJS.extend({
|
* var app.appname = AppJS.extend({
|
||||||
* // Actually set this one, the rest is example
|
* // Actually set this one, the rest is example
|
||||||
@ -34,9 +46,9 @@ window.app = {};
|
|||||||
* {
|
* {
|
||||||
* // Call the super
|
* // Call the super
|
||||||
* this._super.apply(this, arguments);
|
* this._super.apply(this, arguments);
|
||||||
*
|
*
|
||||||
* // Init the stuff
|
* // Init the stuff
|
||||||
* if ( egw.preference('dateformat', 'common') )
|
* if ( egw.preference('dateformat', 'common') )
|
||||||
* {
|
* {
|
||||||
* // etc
|
* // etc
|
||||||
* }
|
* }
|
||||||
@ -47,18 +59,18 @@ window.app = {};
|
|||||||
* }
|
* }
|
||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
var AppJS = Class.extend({
|
var AppJS = Class.extend(
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Internal application name - override this
|
* Internal application name - override this
|
||||||
*/
|
*/
|
||||||
appname: '',
|
appname: '',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal reference to etemplate2 widget tree
|
* Internal reference to etemplate2 widget tree
|
||||||
*/
|
*/
|
||||||
et2: null,
|
et2: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal reference to egw client-side api object for current app and window
|
* Internal reference to egw client-side api object for current app and window
|
||||||
*/
|
*/
|
||||||
@ -70,7 +82,7 @@ var AppJS = Class.extend({
|
|||||||
*/
|
*/
|
||||||
init: function() {
|
init: function() {
|
||||||
window.app[this.appname] = this;
|
window.app[this.appname] = this;
|
||||||
|
|
||||||
this.egw = egw(this.appname, window);
|
this.egw = egw(this.appname, window);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -97,13 +109,13 @@ var AppJS = Class.extend({
|
|||||||
}
|
}
|
||||||
this.et2 = et2.widgetContainer;
|
this.et2 = et2.widgetContainer;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open an entry.
|
* Open an entry.
|
||||||
*
|
*
|
||||||
* Designed to be used with the action system as a callback
|
* Designed to be used with the action system as a callback
|
||||||
* eg: onExecute => app.<appname>.open
|
* eg: onExecute => app.<appname>.open
|
||||||
*
|
*
|
||||||
* @param _action
|
* @param _action
|
||||||
* @param _senders
|
* @param _senders
|
||||||
*/
|
*/
|
||||||
@ -111,26 +123,26 @@ var AppJS = Class.extend({
|
|||||||
var id_app = _senders[0].id.split('::')
|
var id_app = _senders[0].id.split('::')
|
||||||
egw.open(id_app[1], this.appname);
|
egw.open(id_app[1], this.appname);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A generic method to action to server asynchronously
|
* A generic method to action to server asynchronously
|
||||||
*
|
*
|
||||||
* Designed to be used with the action system as a callback.
|
* Designed to be used with the action system as a callback.
|
||||||
* In the PHP side, set the action
|
* In the PHP side, set the action
|
||||||
* 'onExecute' => 'javaScript:app.<appname>.action', and
|
* 'onExecute' => 'javaScript:app.<appname>.action', and
|
||||||
* implement _do_action(action_id, selected)
|
* implement _do_action(action_id, selected)
|
||||||
*
|
*
|
||||||
* @param {egwAction} _action
|
* @param {egwAction} _action
|
||||||
* @param {egwActionObject[]} _elems
|
* @param {egwActionObject[]} _elems
|
||||||
*/
|
*/
|
||||||
action: function(_action, _elems)
|
action: function(_action, _elems)
|
||||||
{
|
{
|
||||||
// let user confirm select-all
|
// let user confirm select-all
|
||||||
var select_all = _action.getManager().getActionById("select_all");
|
var select_all = _action.getManager().getActionById("select_all");
|
||||||
var confirm_msg = (_elems.length > 1 || select_all && select_all.checked) &&
|
var confirm_msg = (_elems.length > 1 || select_all && select_all.checked) &&
|
||||||
typeof _action.data.confirm_multiple != 'undefined' ?
|
typeof _action.data.confirm_multiple != 'undefined' ?
|
||||||
_action.data.confirm_multiple : _action.data.confirm;
|
_action.data.confirm_multiple : _action.data.confirm;
|
||||||
|
|
||||||
if (typeof confirm_msg != 'undefined')
|
if (typeof confirm_msg != 'undefined')
|
||||||
{
|
{
|
||||||
var that = this;
|
var that = this;
|
||||||
@ -139,13 +151,13 @@ var AppJS = Class.extend({
|
|||||||
{
|
{
|
||||||
if (button_id != et2_dialog.NO_BUTTON)
|
if (button_id != et2_dialog.NO_BUTTON)
|
||||||
{
|
{
|
||||||
that._do_action(action_id, _elems);
|
that._do_action(action_id, _elems);
|
||||||
}
|
}
|
||||||
}, confirm_msg, egw.lang('Confirmation required'), et2_dialog.BUTTONS_YES_NO, et2_dialog.QUESTION_MESSAGE);
|
}, confirm_msg, egw.lang('Confirmation required'), et2_dialog.BUTTONS_YES_NO, et2_dialog.QUESTION_MESSAGE);
|
||||||
}
|
}
|
||||||
else if (typeof this._do_action == 'function')
|
else if (typeof this._do_action == 'function')
|
||||||
{
|
{
|
||||||
this._do_action(_action.id, _elems);
|
this._do_action(_action.id, _elems);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -166,5 +178,5 @@ var AppJS = Class.extend({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
*
|
*
|
||||||
* @augments AppJS
|
* @augments AppJS
|
||||||
*/
|
*/
|
||||||
app.timesheet = AppJS.extend(
|
app.classes.timesheet = AppJS.extend(
|
||||||
{
|
{
|
||||||
appname: 'timesheet',
|
appname: 'timesheet',
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user