About

This is the official blog of Trilancer.com, where you can find various web development related stuff around.

4 comments on “About

  1. The google group is wrought with spam (only 1 real post out of 33 total), so I am putting my question here.

    Let me start by saying thank you for building something like jpolite and offering it up to the masses! Very nice!

    I am trying to come up with a design to house tabs/modules/moduleLayout & columnLayout in the db and tie it to a user (their preferences). I am failing at the columnLayout part. Not sure how to represent this in tables?

    Has someone already done something like this?

    Tabs table and modules table have a many to many relationship with col_id, and optional color class & template name. How do I correlate tab table with columnLayout? Should there simply be stored templates (like _default, t2, etc)? I am really having a hard time visualizing how to do this.

    Thanks!

    • @Joey:

      Guess you’re struggling to store the tree relationship in relational database. A solution I’d probably use FYI:

      1.Users table: id, name …
      2.Tabs table: id, user_id, label
      2.1. Global unique id, correlated to user_id
      2.2. Optionally, you may use user_id = 0 for shared tabs visible to all users
      3.Modules table: id, user_id, title, url …
      3.1. Can be shared or user unique
      3.2. NO correlation to tabs, i.e., modules can be put in any tab
      4.Layout table: user_id, tab_id, layout_data
      4.1. To support the most common use case: retrieve layout data for 1 user
      4.2. Layout_data: just raw JSON hash data (_moduleLayout, _columnLayout), no need to process it at backend
      (No separate table for columns, since they always go with tabs, and no use case for retrieving info for a single column)

      UI initialization sequence:
      1. Select all from Tabs where user_id=ID OR user_id=0 ==> JPolite 2 assume all tabs represented in HTML, you can alter the logic to load via Ajax
      2. Select all from Modules where user_id=ID OR user_id=0 ==> var _modules
      3. Select all from Layout where user_id=ID OR user_id=0 ==> var _moduleLayout, _columnLayout ==> you may revise the logic to combine these 2 vars into 1

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s