Hello,
I am writing an application in Jam that uses the paradigms of
custom login and
multitenancy. I have two questions that I would like some advice on how to do it (a short example code would be appreciated as I am not so proficient in Javascript).
Question 1: The application on the custom users table has extra fields (besides the ones described in the above page) that I would like to have available globally in the app for the logged-on user session. Could the
user_info attribute be extended to include more fields that could be populated during the on_login server module of the task object?
Question 2 (more of the same of Q1 due to somehow messed up Javascript variables scopes in my head): I have an item called ItemA (real table) with the following fields: datestart (TEXT), dateend (TEXT), rnvz (INTEGER). From another item (ItemB) client module (inside the on_view_form_created() function), I have the following code:
function on_view_form_created(item) {
var koskperiod = item.task.itema.copy({handlers: false});
var koskdatestart = "";
var koskdateend = "";
var koskrandevouz = 0;
koskperiod.open(
{
fields: ['datestart','dateend','rnvz'],
where: {isactive: true}
},
function() {
koskperiod.each(function(t) {
koskdatestart = t.datestart.display_text;
koskdateend = t.dateend.display_text;
koskrandevouz = t.rnvz.display_text;
});
}
);
alert(koskrandevouz);
// more code after here
}
My problem is obvious: the variables (e.g koskrandevouz) are not available on the main body of the
on_view_form_created() function and cannot be used from the section after // more code... According to various Javascripts tutorials I've tried, defining the variables within the top of the function would make them available within the on_view_form_created() function, unless I did not understand correctly.
And this comes to my initial question 1: is there some programming paradigm that can be used to create some sort of runtime application "dictionary" that can hold variables to be used within the whole jam.py application scope?
Again, thank you very much in advance for any help and suggestion.
Regards,
Manos