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>
|
||||
* @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
|
||||
* @version $id
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -14,7 +14,7 @@
|
||||
*
|
||||
* @augments AppJS
|
||||
*/
|
||||
app.addressbook = AppJS.extend(
|
||||
app.classes.addressbook = AppJS.extend(
|
||||
{
|
||||
appname: 'addressbook',
|
||||
/**
|
||||
|
@ -11,10 +11,10 @@
|
||||
|
||||
/**
|
||||
* UI for Admin
|
||||
*
|
||||
*
|
||||
* @augments AppJS
|
||||
*/
|
||||
app.admin = AppJS.extend(
|
||||
app.classes.admin = AppJS.extend(
|
||||
{
|
||||
appname: 'admin',
|
||||
/**
|
||||
@ -29,15 +29,15 @@ app.admin = AppJS.extend(
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
*
|
||||
* @memberOf app.filemanager
|
||||
*/
|
||||
init: function()
|
||||
init: function()
|
||||
{
|
||||
// call parent
|
||||
this._super.apply(this, arguments);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
@ -46,7 +46,7 @@ app.admin = AppJS.extend(
|
||||
// call parent
|
||||
this._super.apply(this, arguments);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* This function is called when the etemplate2 object is loaded
|
||||
* 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);
|
||||
|
||||
var iframe = this.iframe = this.et2.getWidgetById('iframe');
|
||||
if (iframe)
|
||||
if (iframe)
|
||||
{
|
||||
var self = this;
|
||||
jQuery(iframe.getDOMNode()).bind('load', function(){
|
||||
@ -70,19 +70,19 @@ app.admin = AppJS.extend(
|
||||
}
|
||||
this.splitter = this.et2.getWidgetById('splitter');
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Hide navbar for idots template
|
||||
*
|
||||
*
|
||||
* Just a hack for old idots, not neccesary for jdots
|
||||
*/
|
||||
_hide_navbar: function()
|
||||
{
|
||||
var document = this.iframe.getDOMNode().contentDocument;
|
||||
|
||||
|
||||
// set white background, as transparent one lets account-list show through
|
||||
document.getElementsByTagName('body')[0].style.backgroundColor = 'white';
|
||||
|
||||
|
||||
// hide navbar elements
|
||||
var ids2hide = ['divLogo', 'topmenu', 'divAppIconBar', 'divStatusBar', 'tdSidebox', 'divAppboxHeader'];
|
||||
for(var i=0; i < ids2hide.length; ++i)
|
||||
@ -91,10 +91,10 @@ app.admin = AppJS.extend(
|
||||
if (elem) elem.style.display = 'none';
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Set location of iframe for given _action and _sender (row)
|
||||
*
|
||||
*
|
||||
* @param _action
|
||||
* @param _senders
|
||||
*/
|
||||
@ -105,10 +105,10 @@ app.admin = AppJS.extend(
|
||||
|
||||
this.iframe.set_src(url);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Link hander for jDots template to just reload our iframe, instead of reloading whole admin app
|
||||
*
|
||||
*
|
||||
* @param _url
|
||||
* @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
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Run an admin module / onclick callback for tree
|
||||
*
|
||||
*
|
||||
* @param string _id id of clicked node
|
||||
* @param et2_tree _widget reference to tree widget
|
||||
*/
|
||||
run: function(_id, _widget)
|
||||
{
|
||||
var link = _widget.getUserData(_id, 'link');
|
||||
|
||||
|
||||
if (_id == '/accounts' || _id.substr(0, 8) == '/groups/')
|
||||
{
|
||||
this.splitter.undock();
|
||||
@ -147,7 +147,7 @@ app.admin = AppJS.extend(
|
||||
}
|
||||
else if (typeof link == 'undefined')
|
||||
{
|
||||
_widget.openItem(_id, 'toggle');
|
||||
_widget.openItem(_id, 'toggle');
|
||||
}
|
||||
else if (link[0] == '/' || link.substr(0,4) == 'http')
|
||||
{
|
||||
@ -159,10 +159,10 @@ app.admin = AppJS.extend(
|
||||
eval(link.substr(11));
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* View, edit or delete a group callback for tree
|
||||
*
|
||||
*
|
||||
* @param Object _action egwAction
|
||||
* @param Object _senders egwActionObject _senders[0].id holds id
|
||||
*/
|
||||
@ -173,29 +173,29 @@ app.admin = AppJS.extend(
|
||||
case 'view':
|
||||
this.run(_senders[0].id, this.et2.getWidgetById('tree'));
|
||||
break;
|
||||
|
||||
|
||||
case 'edit':
|
||||
case 'delete':
|
||||
this.splitter.dock();
|
||||
this.iframe.set_src(egw.link('/index.php', {
|
||||
menuaction: _action.id == 'edit' ? 'admin.uiaccounts.edit_group' : 'admin.uiaccounts.delete_group',
|
||||
this.iframe.set_src(egw.link('/index.php', {
|
||||
menuaction: _action.id == 'edit' ? 'admin.uiaccounts.edit_group' : 'admin.uiaccounts.delete_group',
|
||||
account_id: _senders[0].id.split('/')[2]
|
||||
}));
|
||||
break;
|
||||
|
||||
case 'acl':
|
||||
this.splitter.dock();
|
||||
this.iframe.set_src(egw.link('/index.php', {
|
||||
menuaction: 'admin.admin_acl.index',
|
||||
this.iframe.set_src(egw.link('/index.php', {
|
||||
menuaction: 'admin.admin_acl.index',
|
||||
account_id: _senders[0].id.split('/')[2]
|
||||
}));
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Modify an ACL entry
|
||||
*
|
||||
*
|
||||
* @param Object _action egwAction
|
||||
* @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)
|
||||
.sendRequest();
|
||||
break;
|
||||
|
||||
|
||||
case 'edit':
|
||||
// need to specify window to get correct opener, as admin has multiple windows open!
|
||||
egw('admin', window).open_link(egw.link('/index.php', {
|
||||
@ -232,10 +232,10 @@ app.admin = AppJS.extend(
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Callback called on successfull call of serverside ACL handling
|
||||
*
|
||||
*
|
||||
* @param string _data returned from server
|
||||
*/
|
||||
_acl_callback: function(_data)
|
||||
|
@ -14,7 +14,7 @@
|
||||
*
|
||||
* @augments AppJS
|
||||
*/
|
||||
app.calendar = AppJS.extend(
|
||||
app.classes.calendar = AppJS.extend(
|
||||
{
|
||||
/**
|
||||
* application name
|
||||
|
@ -214,7 +214,13 @@ etemplate2.prototype.load = function(_name, _url, _data, _callback)
|
||||
// Initialize application js
|
||||
var app_callback = null;
|
||||
// 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();
|
||||
}
|
||||
|
@ -11,10 +11,10 @@
|
||||
|
||||
/**
|
||||
* UI for filemanager
|
||||
*
|
||||
*
|
||||
* @augments AppJS
|
||||
*/
|
||||
app.filemanager = AppJS.extend(
|
||||
app.classes.filemanager = AppJS.extend(
|
||||
{
|
||||
appname: 'filemanager',
|
||||
/**
|
||||
@ -36,15 +36,15 @@ app.filemanager = AppJS.extend(
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
*
|
||||
* @memberOf app.filemanager
|
||||
*/
|
||||
init: function()
|
||||
init: function()
|
||||
{
|
||||
// call parent
|
||||
this._super.apply(this, arguments);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
@ -54,7 +54,7 @@ app.filemanager = AppJS.extend(
|
||||
// call parent
|
||||
this._super.apply(this, arguments);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* This function is called when the etemplate2 object is loaded
|
||||
* 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.path_widget = this.et2.getWidgetById('path');
|
||||
|
||||
|
||||
// get clipboard from browser localstore and update button tooltips
|
||||
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_tooltips();
|
||||
|
||||
|
||||
if (typeof this.readonly != 'undefined')
|
||||
{
|
||||
this.set_readonly.apply(this, this.readonly);
|
||||
delete this.readonly;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Regexp to convert id to a path, use this.id2path(_id)
|
||||
*/
|
||||
remove_prefix: /^filemanager::/,
|
||||
/**
|
||||
* Convert id to path (remove "filemanager::" prefix)
|
||||
*
|
||||
*
|
||||
* @param string _id
|
||||
* @returns string
|
||||
*/
|
||||
@ -100,7 +100,7 @@ app.filemanager = AppJS.extend(
|
||||
|
||||
/**
|
||||
* Convert array of elems to array of paths
|
||||
*
|
||||
*
|
||||
* @param array _elems selected items from actions
|
||||
* @return array
|
||||
*/
|
||||
@ -113,10 +113,10 @@ app.filemanager = AppJS.extend(
|
||||
}
|
||||
return paths;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Get directory of a path
|
||||
*
|
||||
*
|
||||
* @param string _path
|
||||
* @returns string
|
||||
*/
|
||||
@ -126,10 +126,10 @@ app.filemanager = AppJS.extend(
|
||||
parts.pop();
|
||||
return parts.join('/') || '/';
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Get name of a path
|
||||
*
|
||||
*
|
||||
* @param string _path
|
||||
* @returns string
|
||||
*/
|
||||
@ -137,20 +137,20 @@ app.filemanager = AppJS.extend(
|
||||
{
|
||||
return _path.split('/').pop();
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Get current working directory
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
get_path: function()
|
||||
{
|
||||
return this.path_widget ? this.path_widget.get_value() : null;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Open compose with already attached files
|
||||
*
|
||||
*
|
||||
* @param string|array attachment path(s)
|
||||
*/
|
||||
open_mail: function(attachments)
|
||||
@ -164,10 +164,10 @@ app.filemanager = AppJS.extend(
|
||||
}
|
||||
egw.open('', 'felamimail', 'add', params);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Mail files action: open compose with already attached files
|
||||
*
|
||||
*
|
||||
* @param _action
|
||||
* @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
|
||||
*
|
||||
*
|
||||
* @param _event
|
||||
* @param _file_count
|
||||
* @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()))
|
||||
{
|
||||
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
|
||||
).sendRequest();
|
||||
widget.set_value('');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Callback for server response to upload request:
|
||||
* - display message and refresh list
|
||||
* - ask use to confirm overwritting existing files or rename upload
|
||||
*
|
||||
*
|
||||
* @param object _data values for attributes msg, files, ...
|
||||
*/
|
||||
_upload_callback: function(_data)
|
||||
@ -254,7 +254,7 @@ app.filemanager = AppJS.extend(
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Update clickboard tooltips in buttons
|
||||
*/
|
||||
@ -267,10 +267,10 @@ app.filemanager = AppJS.extend(
|
||||
if (button) button.set_statustext(this.clipboard_files.join(",\n"));
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Clip files into clipboard
|
||||
*
|
||||
*
|
||||
* @param _action
|
||||
* @param _elems
|
||||
*/
|
||||
@ -278,25 +278,25 @@ app.filemanager = AppJS.extend(
|
||||
{
|
||||
this.clipboard_is_cut = _action.id == "cut";
|
||||
if (_action.id != "add") this.clipboard_files = [];
|
||||
|
||||
|
||||
this.clipboard_files = this.clipboard_files.concat(this._elems2paths(_elems));
|
||||
|
||||
|
||||
if (_action.id == "add" && this.clipboard_files.length > 1)
|
||||
{
|
||||
// ToDo: make sure files are unique
|
||||
}
|
||||
this.clipboard_tooltips();
|
||||
|
||||
|
||||
// update localstore with files
|
||||
if (typeof window.localStorage != 'undefined')
|
||||
{
|
||||
window.localStorage[this.clipboard_localstore_key] = JSON.stringify(this.clipboard_files);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Paste files into current directory or mail them
|
||||
*
|
||||
*
|
||||
* @param _type 'paste', 'linkpaste', 'mailpaste'
|
||||
*/
|
||||
paste: function(_type)
|
||||
@ -311,7 +311,7 @@ app.filemanager = AppJS.extend(
|
||||
case 'mailpaste':
|
||||
this.open_mail(this.clipboard_files);
|
||||
break;
|
||||
|
||||
|
||||
case 'paste':
|
||||
this._do_action(this.clipboard_is_cut ? 'move' : 'copy', this.clipboard_files);
|
||||
|
||||
@ -322,7 +322,7 @@ app.filemanager = AppJS.extend(
|
||||
this.clipboard_tooltips();
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'linkpaste':
|
||||
this._do_action('symlink', this.clipboard_files);
|
||||
break;
|
||||
@ -331,7 +331,7 @@ app.filemanager = AppJS.extend(
|
||||
|
||||
/**
|
||||
* Pass action to server
|
||||
*
|
||||
*
|
||||
* @param _action
|
||||
* @param _elems
|
||||
*/
|
||||
@ -346,16 +346,16 @@ app.filemanager = AppJS.extend(
|
||||
{
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
this._do_action(_action.id, paths);
|
||||
this._do_action(_action.id, paths);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Prompt user for directory to create
|
||||
*/
|
||||
@ -370,7 +370,7 @@ app.filemanager = AppJS.extend(
|
||||
this.change_dir(path+'/'+dir);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Prompt user for directory to create
|
||||
*/
|
||||
@ -383,10 +383,10 @@ app.filemanager = AppJS.extend(
|
||||
this._do_action('symlink', target);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Run a serverside action via an ajax call
|
||||
*
|
||||
*
|
||||
* @param _type 'move_file', 'copy_file', ...
|
||||
* @param _selected selected paths
|
||||
* @param _sync send a synchronous ajax request
|
||||
@ -399,20 +399,20 @@ app.filemanager = AppJS.extend(
|
||||
this._do_action_callback, this, !_sync, this
|
||||
).sendRequest();
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Callback for _do_action ajax call
|
||||
*
|
||||
*
|
||||
* @param _data
|
||||
*/
|
||||
_do_action_callback: function(_data)
|
||||
{
|
||||
window.egw_refresh(_data.msg, this.appname);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Force download of a file by appending '?download' to it's download url
|
||||
*
|
||||
*
|
||||
* @param _action
|
||||
* @param _senders
|
||||
*/
|
||||
@ -423,10 +423,10 @@ app.filemanager = AppJS.extend(
|
||||
if (url[0] == '/') url = egw.link(url);
|
||||
window.location = url+"?download";
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Change directory
|
||||
*
|
||||
*
|
||||
* @param _dir directory to change to incl. '..' for one up
|
||||
*/
|
||||
change_dir: function(_dir)
|
||||
@ -442,10 +442,10 @@ app.filemanager = AppJS.extend(
|
||||
}
|
||||
this.path_widget.set_value(_dir);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Open/active an item
|
||||
*
|
||||
*
|
||||
* @param _action
|
||||
* @param _senders
|
||||
*/
|
||||
@ -463,10 +463,10 @@ app.filemanager = AppJS.extend(
|
||||
egw.open({path: path, type: data.data.mime}, 'file');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Edit prefs of current directory
|
||||
*
|
||||
*
|
||||
* @param _action
|
||||
* @param _senders
|
||||
*/
|
||||
@ -479,10 +479,10 @@ app.filemanager = AppJS.extend(
|
||||
path: path,
|
||||
}), 'fileprefs', '495x425');
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* File(s) droped
|
||||
*
|
||||
*
|
||||
* @param _action
|
||||
* @param _elems
|
||||
* @param _target
|
||||
@ -493,7 +493,7 @@ app.filemanager = AppJS.extend(
|
||||
var src = this._elems2paths(_elems);
|
||||
var dst = this.id2path(_target.id);
|
||||
//alert(_action.id+': '+src.join(', ')+' --> '+dst);
|
||||
|
||||
|
||||
// check if target is a file --> use it's directory instead
|
||||
var data = egw.dataGetUIDdata(_target.id);
|
||||
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);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Handle a native / HTML5 file drop from system
|
||||
*
|
||||
*
|
||||
* 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 {File[]} Array of Files
|
||||
*/
|
||||
@ -516,27 +516,27 @@ app.filemanager = AppJS.extend(
|
||||
{
|
||||
var self = this;
|
||||
var data = egw.dataGetUIDdata(row_uid);
|
||||
|
||||
|
||||
var path = data.data.mime == "httpd/unix-directory" ? data.data.path : this.get_path();
|
||||
var widget = this.et2.getWidgetById('upload');
|
||||
|
||||
|
||||
// Override finish to specify a potentially different path
|
||||
var old_onfinish = widget.options.onFinish;
|
||||
|
||||
|
||||
widget.options.onFinish = function(_event, _file_count) {
|
||||
widget.options.onFinish = old_onfinish;
|
||||
self.upload(_event, _file_count, path);
|
||||
}
|
||||
// This triggers the upload
|
||||
widget.set_value(files);
|
||||
|
||||
|
||||
// Return false to prevent the link
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Get drag helper, called on drag start
|
||||
*
|
||||
*
|
||||
* @param _action
|
||||
* @param _elems
|
||||
* @return some dome objects
|
||||
@ -582,10 +582,10 @@ app.filemanager = AppJS.extend(
|
||||
// Create a stack of images
|
||||
var img = $j(document.createElement('img'));
|
||||
img.css({
|
||||
position: 'absolute',
|
||||
'z-index': 10000-i,
|
||||
top: idx*5,
|
||||
left: idx*5,
|
||||
position: 'absolute',
|
||||
'z-index': 10000-i,
|
||||
top: idx*5,
|
||||
left: idx*5,
|
||||
opacity: (maxCnt - idx) / maxCnt
|
||||
});
|
||||
img.attr('src', icons[i]);
|
||||
@ -604,19 +604,19 @@ app.filemanager = AppJS.extend(
|
||||
div.append(text);
|
||||
|
||||
// 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)
|
||||
{
|
||||
text.append('<br />' + this.egw.lang('Hold Ctrl to drag files to your computer'));
|
||||
}
|
||||
return div;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
*
|
||||
* @param _path
|
||||
* @param _ro
|
||||
*/
|
||||
@ -629,14 +629,14 @@ app.filemanager = AppJS.extend(
|
||||
return;
|
||||
}
|
||||
var path = this.path_widget.getValue();
|
||||
|
||||
|
||||
if (_path == path)
|
||||
{
|
||||
var ids = ['button[linkpaste]', 'button[paste]', 'button[createdir]', 'button[symlink]', 'upload'];
|
||||
for(var i=0; i < ids.length; ++i)
|
||||
{
|
||||
var widget = this.et2.getWidgetById(ids[i]);
|
||||
if (widget)
|
||||
if (widget)
|
||||
{
|
||||
if (widget._type == 'button' || widget._type == 'buttononly')
|
||||
{
|
||||
@ -650,7 +650,7 @@ app.filemanager = AppJS.extend(
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Functions for the select dialog
|
||||
*/
|
||||
@ -672,7 +672,7 @@ app.filemanager = AppJS.extend(
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
select_show: function(file)
|
||||
{
|
||||
var editfield = this.et2.getWidgetById('name');
|
||||
|
@ -19,15 +19,15 @@
|
||||
|
||||
/**
|
||||
* JS for home application
|
||||
*
|
||||
*
|
||||
* Home is a collection of little bits of content (portlets) from the other applications.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Uses Gridster for the grid layout
|
||||
* @see http://gridster.net
|
||||
* @augments AppJS
|
||||
*/
|
||||
app.home = AppJS.extend(
|
||||
app.classes.home = AppJS.extend(
|
||||
{
|
||||
/**
|
||||
* AppJS requires overwriting this with the actual application name
|
||||
@ -49,7 +49,7 @@ app.home = AppJS.extend(
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
*
|
||||
* @memberOf app.home
|
||||
*/
|
||||
init: function()
|
||||
@ -84,7 +84,7 @@ app.home = AppJS.extend(
|
||||
this._super.apply(this, arguments);
|
||||
|
||||
this.portlet_container = this.et2.getWidgetById("portlets");
|
||||
|
||||
|
||||
// Don't do twice
|
||||
if(this.portlet_container._children.length > 0) return;
|
||||
|
||||
@ -226,11 +226,11 @@ app.home = AppJS.extend(
|
||||
* @return Object - will be returned by gridster.serialize()
|
||||
*/
|
||||
serialize_params: function($w, grid) {
|
||||
return {
|
||||
id: $w.attr("id"),
|
||||
row: grid.row,
|
||||
col: grid.col,
|
||||
width: grid.width,
|
||||
return {
|
||||
id: $w.attr("id"),
|
||||
row: grid.row,
|
||||
col: grid.col,
|
||||
width: grid.width,
|
||||
height: grid.height
|
||||
};
|
||||
},
|
||||
@ -296,7 +296,7 @@ app.home = AppJS.extend(
|
||||
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.
|
||||
*
|
||||
* @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
|
||||
portlet.content.append(list.getDOMNode());
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
// Create widget
|
||||
list = et2_createWidget('link-list', {id: id+'-list'}, portlet);
|
||||
@ -375,7 +375,7 @@ app.home = AppJS.extend(
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
new_list.push(add);
|
||||
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);
|
||||
}
|
||||
widget._process_edit(et2_dialog.BUTTONS_OK_CANCEL,{
|
||||
list: widget.options.settings.list || {},
|
||||
list: widget.options.settings.list || {},
|
||||
dropped_data: drop_data
|
||||
});
|
||||
}
|
||||
|
@ -14,10 +14,10 @@
|
||||
*
|
||||
* @augments AppJS
|
||||
*/
|
||||
app.importexport = AppJS.extend(
|
||||
app.classes.importexport = AppJS.extend(
|
||||
{
|
||||
appname: 'importexport',
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -37,7 +37,7 @@ app.importexport = AppJS.extend(
|
||||
// call parent
|
||||
this._super.apply(this, arguments);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* This function is called when the etemplate2 object is loaded
|
||||
* and ready. If you must store a reference to the et2 object,
|
||||
@ -49,7 +49,7 @@ app.importexport = AppJS.extend(
|
||||
{
|
||||
// call parent
|
||||
this._super.apply(this, arguments);
|
||||
|
||||
|
||||
if(this.et2.getWidgetById('export') && !this.et2.getArrayMgr("content").getEntry("definition"))
|
||||
{
|
||||
// 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');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
export_preview: function(event, widget)
|
||||
{
|
||||
var preview = $j(widget.getRoot().getWidgetById('preview_box').getDOMNode());
|
||||
$j('.content',preview).empty();
|
||||
|
||||
|
||||
preview
|
||||
.addClass('loading')
|
||||
.show(100, jQuery.proxy(function() {
|
||||
@ -74,12 +74,12 @@ app.importexport = AppJS.extend(
|
||||
},this));
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
import_preview: function(event, widget)
|
||||
{
|
||||
var test = widget.getRoot().getWidgetById('dry-run');
|
||||
if(!test.getValue()) return true;
|
||||
|
||||
|
||||
// Show preview
|
||||
var preview = $j(widget.getRoot().getWidgetById('preview_box').getDOMNode());
|
||||
$j('.content',preview).empty();
|
||||
|
@ -6,7 +6,7 @@
|
||||
* @author Hadi Nategh <hn-AT-stylite.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
|
||||
* @version
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -14,7 +14,7 @@
|
||||
*
|
||||
* @augments AppJS
|
||||
*/
|
||||
app.infolog = AppJS.extend(
|
||||
app.classes.infolog = AppJS.extend(
|
||||
{
|
||||
appname: 'infolog',
|
||||
/**
|
||||
|
@ -14,7 +14,7 @@
|
||||
*
|
||||
* @augments AppJS
|
||||
*/
|
||||
app.mail = AppJS.extend(
|
||||
app.classes.mail = AppJS.extend(
|
||||
{
|
||||
appname: 'mail',
|
||||
|
||||
|
@ -15,14 +15,26 @@
|
||||
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
|
||||
* Each app should extend as needed.
|
||||
*
|
||||
* 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({
|
||||
* // Actually set this one, the rest is example
|
||||
@ -34,9 +46,9 @@ window.app = {};
|
||||
* {
|
||||
* // Call the super
|
||||
* this._super.apply(this, arguments);
|
||||
*
|
||||
*
|
||||
* // Init the stuff
|
||||
* if ( egw.preference('dateformat', 'common') )
|
||||
* if ( egw.preference('dateformat', 'common') )
|
||||
* {
|
||||
* // etc
|
||||
* }
|
||||
@ -47,18 +59,18 @@ window.app = {};
|
||||
* }
|
||||
* });
|
||||
*/
|
||||
var AppJS = Class.extend({
|
||||
|
||||
var AppJS = Class.extend(
|
||||
{
|
||||
/**
|
||||
* Internal application name - override this
|
||||
*/
|
||||
appname: '',
|
||||
|
||||
|
||||
/**
|
||||
* Internal reference to etemplate2 widget tree
|
||||
*/
|
||||
et2: null,
|
||||
|
||||
|
||||
/**
|
||||
* Internal reference to egw client-side api object for current app and window
|
||||
*/
|
||||
@ -70,7 +82,7 @@ var AppJS = Class.extend({
|
||||
*/
|
||||
init: function() {
|
||||
window.app[this.appname] = this;
|
||||
|
||||
|
||||
this.egw = egw(this.appname, window);
|
||||
},
|
||||
|
||||
@ -97,13 +109,13 @@ var AppJS = Class.extend({
|
||||
}
|
||||
this.et2 = et2.widgetContainer;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Open an entry.
|
||||
*
|
||||
* Open an entry.
|
||||
*
|
||||
* Designed to be used with the action system as a callback
|
||||
* eg: onExecute => app.<appname>.open
|
||||
*
|
||||
*
|
||||
* @param _action
|
||||
* @param _senders
|
||||
*/
|
||||
@ -111,26 +123,26 @@ var AppJS = Class.extend({
|
||||
var id_app = _senders[0].id.split('::')
|
||||
egw.open(id_app[1], this.appname);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* A generic method to action to server asynchronously
|
||||
*
|
||||
*
|
||||
* Designed to be used with the action system as a callback.
|
||||
* 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)
|
||||
*
|
||||
* @param {egwAction} _action
|
||||
*
|
||||
* @param {egwAction} _action
|
||||
* @param {egwActionObject[]} _elems
|
||||
*/
|
||||
action: function(_action, _elems)
|
||||
{
|
||||
// let user confirm 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' ?
|
||||
_action.data.confirm_multiple : _action.data.confirm;
|
||||
|
||||
|
||||
if (typeof confirm_msg != 'undefined')
|
||||
{
|
||||
var that = this;
|
||||
@ -139,13 +151,13 @@ var AppJS = Class.extend({
|
||||
{
|
||||
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);
|
||||
}
|
||||
else if (typeof this._do_action == 'function')
|
||||
{
|
||||
this._do_action(_action.id, _elems);
|
||||
this._do_action(_action.id, _elems);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -166,5 +178,5 @@ var AppJS = Class.extend({
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
@ -14,7 +14,7 @@
|
||||
*
|
||||
* @augments AppJS
|
||||
*/
|
||||
app.timesheet = AppJS.extend(
|
||||
app.classes.timesheet = AppJS.extend(
|
||||
{
|
||||
appname: 'timesheet',
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user