• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Record label site

#1
[eluser]skeletonfriend[/eluser]
Hi all,

I'm currently developing a site for a record label and I have some difficulties in deciding which way to go with one of the functions/modules in the backend-system.

Right now I'm working with the "Add a new album" part of the backend-system, I'll try to explain my problem....

I've split up the database in several tables:

- albums (info about the specific album)
- album_formats (info about available formats)
- album_types (info about available types...Split, Collaboration, Compilation, Standard and so forth. Different rules apply depending on the type selected)
- album_artists (info about which artist(s) belonging to an album)
- artists (info about artists)

As is:
-------
When the user wants to create an album, he clicks the create album-link and goes to the create album-page. At this moment, the album doesn't exist yet, but somehow I want to make the user able to connect artists to the album before everything is saved (in the same form).
I did come up with the idea to create an album in the db when the user receives the create album-page (with null values, to get the primary key).
The controller first looks into a method in the model class to delete albums older than 10 minutes with null values in it, in order to get rid of faulty albums or whatever.
This way I can add artists to the album "before" it's created...and when I actually post the form, I'll perform an update on the specific album. PUH!

To be:
-------
When I add an artist I redirect to the same controller but add an uri-segment....what I want to do is somehow redirect to the same page, without parameters/uri-segments. But I need to check if the page is posted or not (I don't want to perform updates for every postback). In ASP.NET you check for IsPostBack-event, is there any similar way I can do this?

The easiest way to all this would be to divide it into steps, like a wizard with different pages performing different tasks...but I would, if possible, like to have in one single form/page.

Do any of you perhaps have a better way/idea of handling the flow?

I would really appreciate some thoughts on this....

#2
[eluser]Sumon[/eluser]
why not use session while you don't like to useuri-segment..

One other way might be like...
Save all data instantly and create a maintenance controller which check and delete not complete albums. Make sure the album not created in last 10 or 20 minutes.

#3
[eluser]Randy Casburn[/eluser]
@skeleton - you should investigate "Flash" variables stored in sessions. This would be a good approximation of the ASP.NET IsPostBack-event. Store your "state" in your session flash and upon each reload recover the flash, execute your code based upon the flash variable stored. Store new content in the flash and continue on with your "wizard".

Should meet your needs,

Randy


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.