Commit edc8beed authored by Project Open's avatar Project Open

- Added getDebug to PO.Utilities statics procs

parent 9beea194
......@@ -82,9 +82,6 @@ Ext.define('PO.Utilities', {
msgBox.setOverflowXY('auto', 'auto');
},
/**
* Write out a message
*/
......@@ -146,6 +143,26 @@ Ext.define('PO.Utilities', {
PO.Utilities.reportError("Error loading "+storeName, errorMsg)
},
/**
* Determine if debug is switched on for certain IDs.
* Check Admin -> Parameters -> intranet-timesheet2-weekly -> DebugHash
*/
getDebug: function(id) {
// Extract debugHash from ]po[ parameters
var debugHash = @debug_json;noquote@;
// Check for a debug setting for the specific Id
var debug = parseInt(debugHash[id]);
if (!isNaN(debug)) return debug;
// Use the default debug
debug = parseInt(debugHash['default']);
if (!isNaN(debug)) return debug;
// invalid configuration - enable debug
return 1;
},
/**
* Extract the current userId from the OpenACS session cookie
*/
......@@ -185,7 +202,7 @@ Ext.define('PO.Utilities', {
mm = (m = d.getMinutes()) < 10 ? ('0'+m) : m;
ss = (s = d.getSeconds()) < 10 ? ('0'+s) : s;
// Handle time zone. Time zones with fractions of an hour need to be added with ':30'
// Handle time zone. Time zones with fractions of an hour need to be added with ':30'
tzSign = (tzo = d.getTimezoneOffset()/-60) < 0 ? '-' : '+';
tzAbs = Math.abs(tzo);
if (Math.floor(tzAbs) != tzAbs) {
......
......@@ -27,3 +27,12 @@ set sencha_version [lindex $sencha_version_tuples 0]; # "v421" or similar
set sencha_version_prod_dev [lindex $sencha_version_tuples 1]; # "dev" or "prod"
set sencha_version_package [lindex $sencha_version_tuples 2]; # "sencha-extjs-v421-dev" or similar
# Create a debug JSON object that controls logging verbosity
set debug_default "default 0"
set debug_list [parameter::get_from_package_key -package_key "intranet-gantt-editor" -parameter DebugHash -default $debug_default]
array set debug_hash $debug_list
set debug_json_list {}
foreach id [array names debug_hash] { lappend debug_json_list "'$id': $debug_hash($id)" }
set debug_json "{\n\t[join $debug_json_list ",\n\t"]\n}"
Markdown is supported
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