Re: Need some fresh ideas



pbd22 wrote:

I have been wrestling with a problem for over a week now and I
think I need to breathe and rethink my approach. I am wondering
if somebody wouldn't mind telling me how they would tackle the
problem (rather than tell me why my code is failing)?

The problem:

* I have an upload form that allows a user to browse and select
multiple files for upload.
* The form has several elements on it for data input. All elements
are reused for each file.
* A user clicks on a file in the upload queue, activating the
elements for this particular file. He then adds text, selects radio
buttons, etc. When he is done, the information is saved for that
given file when he moves to the next file. If he returns to a file
that already has user-defined data for it, then that data is loaded.

This is what I am trying to do.

This should be a quite classical RDBMS design scheme, looks like MS
SQL Server in your case. Based on your demo (*) I would suggest the
following structure:

Table [users]:
usersID|name|username|password|remarks|email|blanco|blanco2

Table [uploads]:
uploadsID|filename|usersID|title|description|tags|categoriesID|
languagesID|radio1|radio2|morespecs...|blanco1|blanco2

Table [categories]:
categoriesID|description

Table [languages]:
languagesID|description

Relations:
[users]![usersID] to [uploads]![usersID]: 1 to N
[uploads]![categoriesID] to [categories]![categoriesID]: N to 1
[uploads]![languagesID] to [languages]![languagesID]: N to 1

Indices:
[users]![usersID]
[uploads]![uploadsID]
[uploads]![usersID]
[uploads]![categoriesID]
[uploads]![languagesID]
[categories]![categoriesID]
[languages]![languagesID]

The way I am currently approaching the problem is:

* When a user adds a new file, an addFile function is triggered that
fills a multidimensional array fileList[the file number][data
elements on the page]

I think there is no need for javascript here; actions for _adding_ a
new file:
- user enters data
- asp server script validates the input
- asp inserts in database
- asp stores the uploaded file in writable folder, and refers from MS
SQL Server to it (like unique file name or ID)

* When a user clicks on a file for upload, selectFile is triggered
which both a) loads previously added user-defined data if it exists
and b) dynamically adds the editFile() function to the data
elements passing the clicked-on file as a parameter.
* editFile updates the form data (if need be).

Actions for _editing_ a file's specifications could be:
- user clicks on file in list
- XMLHttpRequest loads data from SQL Server into the form elements
(**)
- user edits data
- asp validates data and does update-actions

(*) http://i103.photobucket.com/albums/m156/pbd22/UI.jpg
(**) This is the modern strategy. A more old-style approach would take
you to a GET request like /edit.aspx?uploadsID=5 and let the form fill
by asp.

I think the actions for _delete_ should be evident.

I don't see any need for javascript on your demo page, except:

- Collapse/Expand buttons at the right
- XMLHttpRequest if you follow the modern strategy from the _editing_
procedure
- Confirm box for the delete actions

Hope this helps,

--
Bart

.