fixing scope of "use strict", so we do not need to remove it when concatinating our scripts like we do now with minjs

This commit is contained in:
Ralf Becker 2016-02-29 15:50:24 +00:00
parent bbf6ca54ac
commit 033c1f4a9f
27 changed files with 219 additions and 199 deletions

View File

@ -7,14 +7,13 @@
* @description Framework base module which creates fw_base object and includes basic framework functionallity
*/
"use strict";
/*egw:uses
jquery.jquery;
egw_inheritance.js;
*/
var fw_base = Class.extend({
var fw_base = (function(){ "use strict"; return Class.extend(
{
/**
* Framework base class constructor sets up basic initialization
* @param {type} _sidemenuId
@ -398,7 +397,7 @@ var fw_base = Class.extend({
this.storeTabsStatus();
}
},
/**
* Store last status of tabs
* tab status being used in order to open all previous opened
@ -419,7 +418,7 @@ var fw_base = Class.extend({
egw.jsonq("home.jdots_framework.ajax_tab_changed_state", [data]);
}
},
/**
* @param {function} _opened
* Sends sidemenu entry category open/close information to the server using an AJAX request
@ -1043,4 +1042,4 @@ var fw_base = Class.extend({
}
}
}
});
});}).call(this);

View File

@ -17,11 +17,9 @@
EGW_BROWSER_TYPE_NONE = 0;
EGW_BROWSER_TYPE_IFRAME = 1;
EGW_BROWSER_TYPE_DIV = 2;
"use strict";
var fw_browser = Class.extend({
var fw_browser = (function(){ "use strict"; return Class.extend(
{
/**
* @param {string} _app
* @param {function} _heightCallback
@ -167,13 +165,13 @@ var fw_browser = Class.extend({
this.loadingDeferred.always(function() {
if(self.ajaxLoaderDiv)
{
self.ajaxLoaderDiv = egw.loading_prompt(self.app.appName,false);
// Remove escape timeout
clearTimeout(self.ajaxLoaderDivTimeout);
}
});
// Check whether the given url is a pseudo url which should be executed
@ -323,7 +321,7 @@ var fw_browser = Class.extend({
if (this.app.sidemenuEntry)
this.app.sidemenuEntry.hideAjaxLoader();
// egw_widgetReplace(this.app.appName, this.contentDiv, this.data);
content = {
var content = {
html: this.data,
js: ''
};
@ -373,7 +371,4 @@ var fw_browser = Class.extend({
{
this.browse('about:blank', this.type == EGW_BROWSER_TYPE_IFRAME);
}
});
});}).call(this);

View File

@ -8,7 +8,6 @@
* @description Create jdots framework
*/
"use strict";
/*egw:uses
jquery.jquery;
framework.fw_base;
@ -17,7 +16,15 @@
egw_fw_classes;
egw_inheritance.js;
*/
(function(window){
/**
*
* @param {DOMWindow} window
*/
(function(window)
{
"use strict";
/**
*
* @type @exp;fw_ui_sidemenu_entry@call;extend
@ -84,12 +91,8 @@
*
* @type @exp;fw_ui_sidemenu@call;extend
*/
var desktop_ui_sidemenu = fw_ui_sidemenu.extend({
/**
*
* @returns {undefined}
*/
var desktop_ui_sidemenu = fw_ui_sidemenu.extend(
{
init: function(_baseDiv, _sortCallback)
{
this._super.apply(this,arguments);
@ -211,7 +214,7 @@
/**
*
* @returns {undefined}
* @param {array} apps
*/
loadApplications: function (apps)
{

View File

@ -13,21 +13,14 @@
egw_inheritance.js;
*/
/**
* Constants definition
*/
"use strict";
/**
* ui siemenu entry class
* Basic sidebar menu implementation
*
* @type @exp;Class@call;extend
*/
var fw_ui_sidemenu_entry = Class.extend({
var fw_ui_sidemenu_entry = (function(){ "use strict"; return Class.extend(
{
/**
* Framework ui sidemenu entry class constructor
*
@ -179,13 +172,14 @@ var fw_ui_sidemenu_entry = Class.extend({
$j(this.headerDiv).remove();
$j(this.contentDiv).remove();
}
});
});}).call(this);
/**
*
* @type @exp;Class@call;extend
*/
var fw_ui_sidemenu = Class.extend({
var fw_ui_sidemenu = (function(){ "use strict"; return Class.extend(
{
/**
* The constructor of the egw_fw_ui_sidemenu.
*
@ -279,7 +273,7 @@ var fw_ui_sidemenu = Class.extend({
this.entries = new Array();
}
});
});}).call(this);
/**
* Class: egw_fw_ui_tab
@ -850,12 +844,12 @@ function egw_fw_ui_scrollarea(_contDiv)
var self = this;
$j(this.scrollDiv).on('mousewheel',function(e, delta) {
var noscroll = false;
// Do not scrolldown/up when we are on selectbox items
// seems Firefox does not prevent the mousewheel event over
// selectbox items with scrollbars
// Do not scroll on video tutorials as well
if (e.target.tagName == "OPTION" || e.target.tagName == "SELECT" ||
if (e.target.tagName == "OPTION" || e.target.tagName == "SELECT" ||
e.target.getAttribute('class') && e.target.getAttribute('class').match(/egw_tutorial/ig))
{
noscroll = true;

View File

@ -11,8 +11,6 @@
* @version $Id$
*/
"use strict";
/*egw:uses
egw_inheritance;
/phpgwapi/js/es6-promise.min.js;
@ -65,7 +63,7 @@ window.app = {classes: {}};
* @class AppJS
* @augments Class
*/
var AppJS = Class.extend(
var AppJS = (function(){ "use strict"; return Class.extend(
{
/**
* Internal application name - override this
@ -83,7 +81,7 @@ var AppJS = Class.extend(
*
* If you need a reference to a certain template you can either store a local
* reference or access it through etemplate2.
*
*
* @example <caption>Store a local reference</caption>
* // in et2_ready()
* if(name == 'index') this.index_et2 = et2.widgetContainer;
@ -383,14 +381,14 @@ var AppJS = Class.extend(
return state;
},
/**
* Function to load selected row from nm into a template view
*
*
* @param {object} _action
* @param {object} _senders
* @param {object} _senders
*/
viewEntry: function(_action, _senders)
viewEntry: function(_action, _senders)
{
// app id in nm
var id = _senders[0].id;
@ -398,21 +396,21 @@ var AppJS = Class.extend(
var id_app = '';
var content = {};
var self = this;
if (id){
id_app = id.split('::');
content = egw.dataGetUIDdata(id);
if (content.data) content = content.data;
}
/* destroy generated etemplate for view mode in DOM*/
var destroy = function(){
self.viewContainer.remove();
delete self.viewTemplate;
delete self.viewContainer;
};
// view container
this.viewContainer = jQuery(document.createElement('div'))
.addClass('et2_mobile_view')
@ -430,13 +428,13 @@ var AppJS = Class.extend(
"padding":'60px 0 10px 0'})
.attr('id','popupMainDiv')
.appendTo('body');
// close button
var close = jQuery(document.createElement('span'))
.addClass('egw_fw_mobile_popup_close loaded')
.click(function(){destroy();})
.appendTo(this.viewContainer);
// edit button
var edit = jQuery(document.createElement('span'))
.addClass('mobile-view-editBtn')
@ -445,18 +443,18 @@ var AppJS = Class.extend(
})
.text(egw.lang('Edit'))
.appendTo(this.viewContainer);
// view template main container (content)
this.viewTemplate = jQuery(document.createElement('div'))
.attr('id', this.appname+'-view')
.addClass('et2_mobile-view-container')
.appendTo(this.viewContainer);
var templateName = _action.data.mobileViewTemplate || 'edit.xet';
var etemplate = new etemplate2 (this.viewTemplate[0], false);
var template = egw.webserverUrl+ '/' + this.appname + '/templates/mobile/'+templateName+'?1';
var data = {content:content, readonlys:{'__ALL__':true,'link_to':false}, currentapp:id_app[0]};
if(template.indexOf('.xet') > 0)
{
// File name provided, fetch from server
@ -466,9 +464,9 @@ var AppJS = Class.extend(
{
// Just template name, it better be loaded already
etemplate.load(template,'',data);
}
}
},
/**
* Initializes actions and handlers on sidebox (delete)
*
@ -696,7 +694,7 @@ var AppJS = Class.extend(
// still running under iframe and that gets into conflict with et2 object created for
// video tutorials in sidebox.
// TODO: this.appname != 'calendar' should be removed after we released new calendar
).appendTo(this.et2 && this.appname != 'calendar' ? this.et2.getDOMNode() : $j('body'));
).appendTo(this.et2 && this.appname != 'calendar' ? this.et2.getDOMNode() : $j('body'));
$j(".ui-icon-circle-plus",this.favorite_popup).prev().andSelf().click(function() {
var details = $j("#"+self.appname+"_favorites_popup_state",self.favorite_popup)
@ -719,7 +717,7 @@ var AppJS = Class.extend(
// Ugly hack to exclude calendar from using this.et2 since calendar in 14.3
// still running under iframe and that gets into conflict with et2 object created for
// video tutorials in sidebox.
// TODO: this.appname != 'calendar' should be removed after we released new calendar
// TODO: this.appname != 'calendar' should be removed after we released new calendar
},(this.et2 && this.appname != 'calendar'? this.et2:null));
this.favorite_popup.group.loadingFinished();
}
@ -1091,7 +1089,7 @@ var AppJS = Class.extend(
}).sendRequest(true);
}
},
/**
* Get json data for videos from the given url
*
@ -1187,7 +1185,7 @@ var AppJS = Class.extend(
var url = egw.link('/index.php', 'menuaction=home.home_tutorial_ui.popup&tuid='+_tuid);
egw.open_link(url,'_blank','960x580');
},
/**
* Check if Mailvelope is available, open (or create) "egroupware" keyring and call callback with it
*
@ -1409,7 +1407,7 @@ var AppJS = Class.extend(
var self = this;
var restorePassword = _restorePassword;
var selector = _selector || 'body';
//Clear the
//Clear the
jQuery('iframe[src^="chrome-extension"],iframe[src^="about:blank?mvelo"]').remove();
return new Promise(function(_resolve, _reject){
var resolve = _resolve;
@ -1504,7 +1502,7 @@ var AppJS = Class.extend(
this.mailvelopeInstallationOffer();
}
},
/**
* Create a dialog and offers installation option for installing mailvelope plugin
* plus it offers a video tutorials to get the user morte familiar with mailvelope
@ -1543,7 +1541,7 @@ var AppJS = Class.extend(
{domain:this.egw.lang('Add your domain as "%1" in options to list of email providers and enable API.',
'*.'+this._mailvelopeDomain()), video:"test", control:"true"}
];
dialog(content, function(_button){
if (_button == 'install')
{
@ -1552,7 +1550,7 @@ var AppJS = Class.extend(
// ATM we are not able to trigger mailvelope installation directly
// since the installation should be triggered from the extension
// owner validate website (mailvelope.com), therefore, we just redirect
// user to chrome webstore to install mailvelope from there.
// user to chrome webstore to install mailvelope from there.
window.open('https://chrome.google.com/webstore/detail/mailvelope/kajibbejlbohfaggdiogboambcijhkke');
}
else if (typeof InstallTrigger != 'undefined' && InstallTrigger.enabled())
@ -1783,4 +1781,4 @@ var AppJS = Class.extend(
});
});
}
});
});}).call(this);

View File

@ -10,8 +10,6 @@
* @version $Id$
*/
"use strict";
/*egw:uses
egw_core;
egw_debug;
@ -37,7 +35,10 @@
app_base;
*/
(function(){
(function()
{
"use strict";
var debug = false;
var egw_script = document.getElementById('egw_script_id');
var start_time = (new Date).getTime();

View File

@ -10,8 +10,6 @@
* @version $Id$
*/
"use strict";
/*egw:uses
jquery.jquery-ui;
jquery.jquery-ui-timepicker-addon;
@ -31,6 +29,8 @@
*/
egw.extend('calendar', egw.MODULE_WND_LOCAL, function(_app, _wnd)
{
"use strict";
// translate only once
var calendar_translated = false,timepicker_translated = false;
@ -272,9 +272,11 @@ egw.extend('calendar', egw.MODULE_WND_LOCAL, function(_app, _wnd)
{
return dateTimeFormat(_php_format);
},
/**
* Calculate the start of the week, according to user's preference
*
* @param {string} date
*/
week_start: function(date) {
var d = new Date(date);

View File

@ -10,13 +10,13 @@
* @version $Id$
*/
"use strict";
/*egw:uses
egw_core;
*/
egw.extend('config', egw.MODULE_GLOBAL, function() {
egw.extend('config', egw.MODULE_GLOBAL, function()
{
"use strict";
/**
* Clientside config

View File

@ -10,13 +10,13 @@
* @version $Id$
*/
"use strict";
/**
* This code setups the egw namespace and adds the "extend" function, which is
* used by extension modules to inject their content into the egw object.
*/
(function() {
(function()
{
"use strict";
var instanceUid = 0;

View File

@ -10,8 +10,6 @@
* @version $Id$
*/
"use strict";
/*egw:uses
egw_core;
*/
@ -23,7 +21,9 @@
* @param {string} _app application name object is instanciated for
* @param {object} _wnd window object is instanciated for
*/
egw.extend('css', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
egw.extend('css', egw.MODULE_WND_LOCAL, function(_app, _wnd)
{
"use strict";
/**
* Assoziative array which stores the current css rule for a given selector.

View File

@ -15,9 +15,15 @@
egw_debug;
*/
"use strict";
egw.extend("data", egw.MODULE_APP_LOCAL, function (_app, _wnd) {
/**
* Module storing and updating row data
*
* @param {string} _app application name object is instanciated for
* @param {object} _wnd window object is instanciated for
*/
egw.extend("data", egw.MODULE_APP_LOCAL, function (_app, _wnd)
{
"use strict";
/**
* How many UIDs we'll tell the server we know about. No need to pass the whole list around.
@ -527,6 +533,11 @@ egw.extend("data_storage", egw.MODULE_GLOBAL, function (_app, _wnd) {
* using dataFetch() && parseServerResponse(), above. Both update the
* GLOBAL data cache though this one is registered globally, and the above
* is registered app local.
*
* @param {string} type
* @param {object} res
* @param {object} req
* @returns {Boolean}
*/
egw.registerJSONPlugin(function(type, res, req) {
if ((typeof res.data.uid != 'undefined') &&
@ -537,7 +548,7 @@ egw.extend("data_storage", egw.MODULE_GLOBAL, function (_app, _wnd) {
return true;
}
}, egw, 'data',true);
/**
* Uids and timers used for querying data uids, hashed by the first few
* bytes of the _execId, stored as an object of the form

View File

@ -10,8 +10,6 @@
* @version $Id$
*/
"use strict";
/*egw:uses
egw_core;
*/
@ -25,7 +23,9 @@
* @param {string} _app
* @param {object} _wnd
*/
egw.extend('debug', egw.MODULE_GLOBAL, function(_app, _wnd) {
egw.extend('debug', egw.MODULE_GLOBAL, function(_app, _wnd)
{
"use strict";
/**
* DEBUGLEVEL specifies which messages are printed to the console.

View File

@ -10,8 +10,6 @@
* @version $Id$
*/
"use strict";
/*egw:uses
egw_core;
egw_ready;
@ -20,9 +18,13 @@
/**
* @augments Class
* @param {string} _app application name object is instanciated for
* @param {object} _wnd window object is instanciated for
*/
egw.extend('files', egw.MODULE_WND_LOCAL, function(_app, _wnd)
{
"use strict";
var egw = this;
/**
@ -128,10 +130,10 @@ egw.extend('files', egw.MODULE_WND_LOCAL, function(_app, _wnd)
* Load and execute javascript file(s) in order
*
* @memberOf egw
* @param string|array _jsFiles (array of) urls to include
* @param function _callback called after JS files are loaded and executed
* @param object _context
* @param string _prefix prefix for _jsFiles
* @param {string|array} _jsFiles (array of) urls to include
* @param {function} _callback called after JS files are loaded and executed
* @param {object} _context
* @param {string} _prefix prefix for _jsFiles
*/
includeJS: function(_jsFiles, _callback, _context, _prefix)
{

View File

@ -10,13 +10,13 @@
* @version $Id$
*/
"use strict";
/*egw:uses
egw_core;
*/
egw.extend('images', egw.MODULE_GLOBAL, function() {
egw.extend('images', egw.MODULE_GLOBAL, function()
{
"use strict";
/**
* Map to serverside available images for users template-set

View File

@ -10,8 +10,6 @@
* @version $Id$
*/
"use strict";
/**
* Usage of the JS inheritance system
* ----------------------------------
@ -71,6 +69,8 @@
*/
(function()
{
"use strict";
var initializing = false;
/**

View File

@ -9,15 +9,20 @@
* @version $Id$
*/
"use strict"
/*egw:uses
egw_core;
egw_files;
egw_ready;
*/
egw.extend('jquery', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
/**
* NOT USED
* @param {string} _app application name object is instanciated for
* @param {object} _wnd window object is instanciated for
*/
egw.extend('jquery', egw.MODULE_WND_LOCAL, function(_app, _wnd)
{
"use strict";
// Get the reference to the "files" and the "ready" module for the current
// window
@ -36,10 +41,6 @@ egw.extend('jquery', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
}, this);
return {
'$j': null
}
'$j': null
};
});

View File

@ -10,8 +10,6 @@
* @version $Id$
*/
"use strict";
/*egw:uses
jquery.jquery;
@ -21,7 +19,15 @@
egw_debug;
*/
egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
/**
* Module sending json requests
*
* @param {string} _app application name object is instanciated for
* @param {object} _wnd window object is instanciated for
*/
egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd)
{
"use strict";
/**
* Object which contains all registered handlers for JS responses.
@ -36,7 +42,7 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
*/
if(typeof egw._global_json_handlers == 'undefined')
{
egw._global_json_handlers = {}
egw._global_json_handlers = {};
}
var global_plugins = egw._global_json_handlers;

View File

@ -10,8 +10,6 @@
* @version $Id$
*/
"use strict";
/*egw:uses
egw_core;
egw_debug;
@ -19,6 +17,8 @@
egw.extend('jsonq', egw.MODULE_GLOBAL, function()
{
"use strict";
/**
* Queued json requests (objects with attributes menuaction, parameters, context, callback, sender and callbeforesend)
*

View File

@ -10,8 +10,6 @@
* @version $Id$
*/
"use strict";
/*egw:uses
egw_core;
egw_files;
@ -21,7 +19,9 @@
/**
* @augments Class
*/
egw.extend('lang', egw.MODULE_GLOBAL, function() {
egw.extend('lang', egw.MODULE_GLOBAL, function()
{
"use strict";
/**
* Translations

View File

@ -9,8 +9,6 @@
* @version $Id$
*/
"use strict";
/*egw:uses
egw_core;
*/
@ -24,6 +22,8 @@
*/
egw.extend('message', egw.MODULE_WND_LOCAL, function(_app, _wnd)
{
"use strict";
_app; // not used, but required by function signature
var message_timer;
var error_reg_exp;
@ -96,7 +96,7 @@ egw.extend('message', egw.MODULE_WND_LOCAL, function(_app, _wnd)
{
// replace p and br-tags with newlines
_msg = _msg.replace(new_line_reg, "\n");
var msg_div = jQuery(_wnd.document.createElement('div'))
.attr('id','egw_message')
.text(_msg)
@ -107,7 +107,7 @@ egw.extend('message', egw.MODULE_WND_LOCAL, function(_app, _wnd)
&& msg_chkbox && msg_chkbox.is(':checked'))
{
var discarded = egw.getLocalStorageItem(egw.app_name(),'discardedMsgs');
if (!isDiscarded(_msg))
{
if (!discarded)
@ -124,7 +124,7 @@ egw.extend('message', egw.MODULE_WND_LOCAL, function(_app, _wnd)
$j(this).remove();
})
.css('position', 'absolute');
// discard checkbox implementation
if (_discard && _type === 'info')
{
@ -132,7 +132,7 @@ egw.extend('message', egw.MODULE_WND_LOCAL, function(_app, _wnd)
var isDiscarded = function (_msg)
{
var discarded = JSON.parse(egw.getLocalStorageItem(egw.app_name(),'discardedMsgs'));
if (jQuery.isArray(discarded))
{
for(var i=0; i< discarded.length; i++)
@ -142,14 +142,14 @@ egw.extend('message', egw.MODULE_WND_LOCAL, function(_app, _wnd)
}
return false;
};
//discard div container
var msg_discard =jQuery(_wnd.document.createElement('div')).addClass('discard');
// checkbox
var msg_chkbox = jQuery(_wnd.document.createElement('input'))
.attr({type:"checkbox",name:"msgChkbox"})
.click(function(e){e.stopImmediatePropagation();})
.click(function(e){e.stopImmediatePropagation();})
.appendTo(msg_discard);
// Label
jQuery(_wnd.document.createElement('label'))
@ -157,13 +157,13 @@ egw.extend('message', egw.MODULE_WND_LOCAL, function(_app, _wnd)
.css({"font-weight":"bold"})
.attr({for:'msgChkbox'})
.appendTo(msg_discard);
if (isDiscarded(_msg)) return;
if (isDiscarded(_msg)) return;
msg_div.append(msg_discard);
}
parent.prepend(msg_div);
// replace simple a href (NO other attribute, to gard agains XSS!)
var matches = a_href_reg.exec(_msg);
if (matches)
@ -239,20 +239,20 @@ egw.extend('message', egw.MODULE_WND_LOCAL, function(_app, _wnd)
_wnd.document.title = _wnd.document.title.replace(/[.*]$/, '['+_header+']');
},
/**
* Loading prompt is for building a loading animation and show it to user
* while a request is under progress.
*
*
* @param {string} _id a unique id to be able to distinguish loading-prompts
* @param {boolean} _stat true to show the loading and false to remove it
* @param {string} _msg a message to show while loading
* @param {string|jQuery node} _node DOM selector id or jquery DOM object, default is body
* @param {string} mode defines the animation mode, default mode is spinner
* animation modes:
* @param {string|jQuery _node} _node DOM selector id or jquery DOM object, default is body
* @param {string} _mode defines the animation mode, default mode is spinner
* animation modes:
* - spinner: a sphere with a spinning bar inside
* - horizental: a horizental bar
*
*
* @returns {jquery dom object|null} returns jQuery DOM object or null in case of hiding
*/
loading_prompt: function(_id,_stat,_msg,_node, _mode)

View File

@ -10,13 +10,13 @@
* @version $Id$
*/
"use strict";
/*egw:uses
egw_core;
*/
egw.extend('preferences', egw.MODULE_GLOBAL, function() {
egw.extend('preferences', egw.MODULE_GLOBAL, function()
{
"use strict";
/**
* Object holding the prefences as 2-dim. associative array, use

View File

@ -9,8 +9,6 @@
* @version $Id$
*/
"use strict"
/*egw:uses
egw_core;
egw_utils;
@ -19,8 +17,12 @@
/**
* @augments Class
* @param {string} _app application name object is instanciated for
* @param {object} _wnd window object is instanciated for
*/
egw.extend('ready', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
egw.extend('ready', egw.MODULE_WND_LOCAL, function(_app, _wnd)
{
"use strict";
var egw = this;
@ -139,7 +141,7 @@ egw.extend('ready', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
* to be marked as "done" before the ready function will call its
* registered callbacks. The function returns an id that has to be
* passed to the "readDone" function once
*
*
* @memberOf egw
*/
readyWaitFor: function() {
@ -181,7 +183,7 @@ egw.extend('ready', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
else
{
setTimeout(function() {
_callback.call(_context)
_callback.call(_context);
}, 1);
}
},

View File

@ -9,16 +9,12 @@
* @version $Id$
*/
"use strict";
/*egw:uses
egw_core;
egw_ready;
egw_debug;
*/
/**
* Store is a wrapper around browser based, persistant storage.
*
@ -28,7 +24,9 @@
* @param {string} _app
* @param {DOMWindow} _wnd
*/
egw.extend('store', egw.MODULE_GLOBAL, function(_app, _wnd) {
egw.extend('store', egw.MODULE_GLOBAL, function(_app, _wnd)
{
"use strict";
var egw = this;
@ -81,12 +79,12 @@ egw.extend('store', egw.MODULE_GLOBAL, function(_app, _wnd) {
key = uniqueKey(application, key);
return _wnd.sessionStorage.removeItem(key);
},
/**
* Set an item to localStorage
*
*
* @param {string} application an application name or a prefix
* @param {string} item
* @param {string} item
* @param {any} value
* @returns {undefined} returns undefined
*/
@ -94,10 +92,10 @@ egw.extend('store', egw.MODULE_GLOBAL, function(_app, _wnd) {
item = mapKey (application, item);
return localStorage.setItem(item,value);
},
/**
* Get an item from localStorage
*
* Get an item from localStorage
*
* @param {string} application an application name or prefix
* @param {stirng} item an item name stored in localStorage
* @return {string|null} reutrns requested item value otherwise null
@ -106,13 +104,13 @@ egw.extend('store', egw.MODULE_GLOBAL, function(_app, _wnd) {
item = mapKey(application, item);
return localStorage.getItem(item);
},
/**
* Remove an item from localStorage
*
*
* @param {string} application application name or prefix
* @param {string} item an item name to remove
* @return {undefined} returns undefined
* @return {undefined} returns undefined
*/
removeLocalStorageItem: function (application, item){
item = mapKey(application, item);

View File

@ -7,11 +7,14 @@
* @link http://www.egroupware.org
* @author Hadi Nategh (as AT stylite.de)
* @author Ralf Becker <RalfBecker@outdoor-training.de>
* @version $Id:
* @version $Id$
*/
$j(function(){
jQuery(function()
{
"use strict";
var that = this;
var log_tail_start=0;

View File

@ -10,14 +10,19 @@
* @version $Id$
*/
"use strict";
/*egw:uses
jquery.jquery;
egw_core;
*/
egw.extend('tooltip', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
/**
*
* @param {string} _app application name object is instanciated for
* @param {object} _wnd window object is instanciated for
*/
egw.extend('tooltip', egw.MODULE_WND_LOCAL, function(_app, _wnd)
{
"use strict";
var tooltip_div = null;
var current_elem = null;
@ -96,6 +101,8 @@ egw.extend('tooltip', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
/**
* Creates the tooltip_div with the given text.
*
* @param {string} _html
*/
function prepare(_html)
{
@ -141,7 +148,7 @@ egw.extend('tooltip', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
* Binds a tooltip to the given DOM-Node with the given html.
* It is important to remove all tooltips from all elements which are
* no longer needed, in order to prevent memory leaks.
*
*
* @param _elem is the element to which the tooltip should get bound. It
* has to be a jQuery node.
* @param _html is the html code which should be shown as tooltip.
@ -198,7 +205,7 @@ egw.extend('tooltip', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
/**
* Unbinds the tooltip from the given DOM-Node.
*
*
* @param _elem is the element from which the tooltip should get
* removed. _elem has to be a jQuery node.
*/
@ -212,7 +219,7 @@ egw.extend('tooltip', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
// Unbind all "tooltip" events from the given element
_elem.unbind('.tooltip');
}
}
};
});

View File

@ -10,14 +10,14 @@
* @version $Id$
*/
"use strict";
/*egw:uses
egw_core;
*/
egw.extend('user', egw.MODULE_GLOBAL, function()
{
"use strict";
/**
* Data about current user
*

View File

@ -10,13 +10,13 @@
* @version $Id$
*/
"use strict";
/*egw:uses
egw_core;
*/
egw.extend('utils', egw.MODULE_GLOBAL, function() {
egw.extend('utils', egw.MODULE_GLOBAL, function()
{
"use strict";
function json_escape_string(input)
{
@ -166,19 +166,19 @@ egw.extend('utils', egw.MODULE_GLOBAL, function() {
/**
* Decode encoded vfs special chars
*
* @param string _path path to decode
* @return string
*
* @param {string} _path path to decode
* @return {string}
*/
decodePath: function(_path) {
return decodeURIComponent(_path);
},
/**
* Encode vfs special chars excluding /
*
* @param string _path path to decode
* @return string
*
* @param {string} _path path to decode
* @return {string}
*/
encodePath: function(_path) {
var components = _path.split('/');
@ -188,20 +188,18 @@ egw.extend('utils', egw.MODULE_GLOBAL, function() {
}
return components.join('/');
},
/**
* Encode vfs special chars removing /
*
*
* //'%' => '%25', // % should be encoded, but easily leads to double encoding, therefore better NOT encodig it
* '#' => '%23',
* '?' => '%3F',
* '/' => '', // better remove it completly
*
* @param string _path path to decode
* @return string
* @param {string} _comp path to decode
* @return {string}
*/
/*
*/
encodePathComponent: function(_comp) {
return _comp.replace(/#/g,'%23').replace(/\?/g,'%3F').replace(/\//g,'');
},
@ -214,7 +212,7 @@ egw.extend('utils', egw.MODULE_GLOBAL, function() {
* @param boolOuter Pass true to get outerWidth() / outerHeight() instead of width() / height()
*
* @return Object [w: width, h: height]
*
*
* @author Ryan Wheale
* @see http://www.foliotek.com/devblog/getting-the-width-of-a-hidden-element-with-jquery-using-width/
*/
@ -248,11 +246,11 @@ egw.extend('utils', egw.MODULE_GLOBAL, function() {
//$.log(”w: ” + dim.w + ”, h:” + dim.h)
return dim;
},
/**
* Store a window's name in egw.store so we can have a list of open windows
*
*
* @param {string} appname
* @param {Window} popup
*/
@ -268,20 +266,20 @@ egw.extend('utils', egw.MODULE_GLOBAL, function() {
var open_windows = JSON.parse(this.getSessionItem(_target_app, 'windows')) || {};
open_windows[popup.name] = Date.now();
this.setSessionItem(_target_app, 'windows', JSON.stringify(open_windows));
// We don't want to start the timer on the popup here, because this is the function that updates the timeout, so it would set a timer each time. Timer is started in egw.js
},
/**
* Get a list of the names of open popups
*
*
* Using the name, you can get a reference to the popup using:
* window.open('', name);
* Popups that were not given a name when they were opened are not tracked.
*
*
* @param {string} appname Application that owns/opened the popup
* @param {string} regex Optionally filter names by the given regular expression
*
*
* @returns {string[]} List of window names
*/
getOpenWindows: function(appname, regex) {
@ -290,7 +288,7 @@ egw.extend('utils', egw.MODULE_GLOBAL, function() {
{
return open_windows;
}
var list = []
var list = [];
var now = Date.now();
for(var i in open_windows)
{
@ -310,7 +308,7 @@ egw.extend('utils', egw.MODULE_GLOBAL, function() {
/**
* Notify egw of closing a named window, which removes it from the list
*
*
* @param {String} appname
* @param {Window|String} closed Window that was closed, or its name
* @returns {undefined}
@ -320,7 +318,7 @@ egw.extend('utils', egw.MODULE_GLOBAL, function() {
var closed_window = typeof closed == "string" ? null : closed;
window.setTimeout(function() {
if(closed_window != null && !closed_window.closed) return;
var open_windows = JSON.parse(egw().getSessionItem(appname, 'windows')) || {};
delete open_windows[closed_name];
egw.setSessionItem(appname, 'windows', JSON.stringify(open_windows));