Commit c7504ba5 authored by Marcel's avatar Marcel
Browse files

Add jQuery logging plugin, add config entry 'client_logging', cleanup configs.

parent a0aa9d02
[global]
# local access only : 127.0.0.1
# local and global access : 0.0.0.0
server.socket_host: "0.0.0.0"
server.socket_port: 4282
server.thread_pool: 10
server.socket_host = "0.0.0.0"
server.socket_port = 4282
server.thread_pool = 10
# reloads the program on script changes
engine.autoreload_on: True
engine.autoreload_on = True
[database]
sqlalchemy.url: sqlite:///var/db/vispa.db
sqlalchemy.url = sqlite:///var/db/vispa.db
[alembic]
# path to migration scripts
......@@ -12,11 +12,14 @@ welcome_text = <center>Welcome to VISPA!</center>
forgot_text = A mail with further instructions will be sent to your mail account!
use_forgot = False
# logging on clientside
client_logging = True
# use base when running in subdirectory
#base: /vispa
#base = /vispa
# set dynamic part seperatly
#base.dynamic: /vispa
#base.static: http://localhost:8080/
#base.dynamic = /vispa
#base.static = http://localhost:8080/
[websockets]
enabled = False
......@@ -36,10 +39,10 @@ manager = local
#manager = condor
[rpc]
verbose: False
verbose = False
# define default workspace id to use.
#default_workspace_id: 1
#default_workspace_id = 1
# command line to start rpc process. use the variables:
# - $PYTHONPATH
......@@ -47,21 +50,21 @@ verbose: False
# - $userid
# - $python
# - $file
#wrapper: ['/usr/bin/sudo', 'PYTHONPATH=$PYTHONPATH', '-E', '-u', '$username', '$python', '-u', '$file']
#wrapper = ['/usr/bin/sudo', 'PYTHONPATH=$PYTHONPATH', '-E', '-u', '$username', '$python', '-u', '$file']
[user]
# user registration
# use $username and $userid variables
#registration.hook: ['useradd', '$username']
#registration.hook = ['useradd', '$username']
registration.autoactive: True
registration.mail_hosts: []
registration.autoactive = True
registration.mail_hosts = []
registration.sendmail: False
registration.activation: http://localhost/activate
registration.forgot: http://localhost/forgot
registration.smpt_host: localhost
#registration.smpt_port: 25
registration.sendmail = False
registration.activation = http://localhost/activate
registration.forgot = http://localhost/forgot
registration.smpt_host = localhost
#registration.smpt_port = 25
[extensions]
ignore: ['workspace']
ignore = ['workspace']
......@@ -56,13 +56,15 @@ class PlatformController(AbstractController):
secure_websockets = vispa.config('websockets', 'secure', False)
profile_id = self.get('profile_id')
preferences = Profile.get_preferences(db, profile_id, parse_json=True)
client_logging = vispa.config('web', 'client_logging', True)
data = {'username' : username,
'common_js' : self._platform.common_js,
'common_css' : self._platform.common_css,
'use_websockets' : use_websockets,
'secure_websockets': secure_websockets,
'workspace_id' : 1,#self.get('workspace_id')
'profile_id' : profile_id}
'profile_id' : profile_id,
'client_logging' : client_logging}
data.update(preferences)
return data
......
jQuery.jqlog={_enabled:false,version:"1.3",targets:[],entryDefaults:{timestamp:null,message:"",format:function(){var a=this.message;if(typeof this.message!="object")a="["+this.timestamp.getDate()+"/"+(this.timestamp.getMonth()+1)+"/"+this.timestamp.getFullYear()+" "+this.timestamp.getHours()+":"+this.timestamp.getMinutes()+":"+this.timestamp.getSeconds()+"."+this.timestamp.getMilliseconds()+"] "+this.message.toString();return a}},targetDefaults:{name:"",log:function(){}},enabled:function(a){if(a!==undefined)this._enabled=a;return this._enabled},log:function(e,d){if(this.enabled()){var b,a,c=jQuery.extend({},this.entryDefaults,{timestamp:new Date,message:e},d);if(!this.isExcluded(c))for(b in this.targets)if(this.targets.hasOwnProperty(b)){a=this.targets[b];if(a.log)try{a.log(c)}catch(f){}}}},isExcluded:function(){return false}};jQuery.fn.log=function(a){return this.each(function(){jQuery.jqlog.log(this,a)})};jQuery.extend(jQuery.jqlog,{_level:null,levels:{debug:0,info:1,warn:2,error:3},level:function(a){if(a!==undefined)this._level=a;return this._level},isExcluded:function(b){var a=false;if(this._level&&b.level!==undefined)a=this._level>b.level;return a},info:function(c,b){var a=jQuery.extend({level:this.levels.info},b);this.log(c,a)},warn:function(c,b){var a=jQuery.extend({level:this.levels.warn},b);this.log(c,a)},error:function(c,b){var a=jQuery.extend({level:this.levels.error},b);this.log(c,a)}});jQuery.jqlog.entryDefaults.level=jQuery.jqlog.levels.debug;jQuery.jqlog.targets.console=jQuery.extend({},jQuery.jqlog.targetDefaults,{name:"console",version:"1.3",log:function(b){var a=b.format();if(window.console)switch(b.level){case jQuery.jqlog.levels.info:console.info(a);break;case jQuery.jqlog.levels.warn:console.warn(a);break;case jQuery.jqlog.levels.error:console.error(a);break;default:console.log(a)}else if(window.firebug)switch(b.level){case jQuery.jqlog.levels.info:firebug.d.console.info(a);break;case jQuery.jqlog.levels.warn:firebug.d.console.warn(a);break;case jQuery.jqlog.levels.error:firebug.d.console.error(a);break;default:firebug.d.console.log(a)}}})
\ No newline at end of file
......@@ -48,6 +48,7 @@
"slimscroll/jquery.slimscroll-horizontal.min.js",
"slimscroll/jquery.slimscroll.min.js",
"jqbrowser/jquery.jqbrowser.min.js",
"jqlog/jquery.jqlog.min.js",
"ludo-jquery-treetable/jquery.treeTable.js",
"tablesorter/jquery.tablesorter.min.js",
"tablesorter/jquery.tablesorter.pager.js"]
......@@ -116,6 +117,9 @@
<%block name="js_inline_post">
$(function() {
// enable logging?
$.jqlog.enabled(${'true' if client_logging else 'false'});
// show the inner startup overlay (css transition)
$('#startup-overlay-inner').toggleClass('visible');
......
......@@ -14,7 +14,8 @@
"qtip/jquery.qtip.min.js",
"ui/jquery.ui.touch-punch.min.js",
"topics/jquery.topics.min.js",
"sha256/jquery.sha256.min.js"]
"sha256/jquery.sha256.min.js",
"jqlog/jquery.jqlog.min.js"]
base_scripts = ["jquery.callbacks.min.js",
"helpers.js",
"messenger.js",
......
......@@ -14,7 +14,8 @@
"qtip/jquery.qtip.min.js",
"ui/jquery.ui.touch-punch.min.js",
"topics/jquery.topics.min.js",
"sha256/jquery.sha256.min.js"]
"sha256/jquery.sha256.min.js",
"jqlog/jquery.jqlog.min.js"]
base_scripts = ["jquery.callbacks.min.js",
"helpers.js",
"messenger.js",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment