/* Copyright 2006 por Connecty Networks. Todos os direitos reservados */
function Profiler() { this.data = {}; this.cfg = { module: "Profiler", hasProfile: false
}
this.addWidget = function(widget) { if(this.data[widget.getSignature()]) { widget.profile = this.data[widget.getSignature()];} else { widget.profile = clone(widget.defaultProfile);}
}
this.saveProfile = function(widget) { var wkey = widget.getSignature(); if(widget.profile) { act = this.data[wkey] ? "update" : "create"; request.send({w: widget.cfg.module, act: act, wkey: wkey, data: escape(toCode(widget.profile))}, this, widget.cfg.saveMethod);} else { request.send({act: "delete", wkey: wkey}, this);}
this.data[wkey] = widget.profile;}
this.loadProfile = function() { request.send({act: "load_profile"}, this);}
this.onLoad = function() {}
this.dispatchMsg = function(msg) { if(msg.status == "loaded") { profiler.data = {}; for(i in msg.data) { profiler.data[i] = toValue(unescape(msg.data[i]));}
profiler.onLoad();}
}
}