Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to store the personalization setting of IGoogle component?

I use IGoogle component inettuts to make my portal more attractive and easy to use interface. The main problem I want to ask about is:

  • How to store the personalization setting, to make it the default when the user logs into the application again?

I can't use cookies because it's related to the user machine so I think I need to store these data in my database. But I don't know the beginning. What should the structure of database look like? And what's the storing mechanism? I mean, should I store every single action of the user or put all the actions in one transaction or what?

I use Informix database, so no membership so I can't use web parts.

I hope someone can help me with an explanation about how to store all the settings in a performant way.

like image 798
Anyname Donotcare Avatar asked Nov 04 '22 05:11

Anyname Donotcare


1 Answers

One thing you can do is make the entire storage client side. Newer browsers have a localStorage variable which can store a string persistantly across sessions. But this way, when they change their computers, the preferences are lost.

Another option is to do all the configuration in JavaScript, but use the backend as a JSON Store.

var settings = {
    components:[
        {
            'title': 'Foo',
            'state': 'opened'
        },
        {
            'title': 'Bar',
            'state': 'opened'
        }
    }
}

function close_component(index)
{
    settings.components[index].state = 'closed';
    save_settings();
}

var save_settings = function() {
    $.ajax({
        url:'/settings/save',
        data: {
            'settings': JSON.stringify(settings)
        }
    };
}
like image 166
skyronic Avatar answered Nov 09 '22 10:11

skyronic