Intricacies of adding an object

Jesper Holmberg <jesperh-auIyqT/[email protected]> Mon, 8 Dec 2003 14:39:56 +0100
Newsgroups gmane.education.weblabs.webreports.uedesign
Message-ID <[email protected]>
OK, here's a description of how the "Insert Object" works in detail, for
you to have opinions about. I have separated how it works in general from 
how the system treats a file which is already present on the server,
although in reality the two algorithms are entwined in the code.


1. General behavior

If the filename ends with '.tt':

  If the file is a zip file:
       Upload the file to the server, extract the 'snapshot.png', and add
       this image to the report, where the image is a link to the .tt file.

  Else:
       Upload the file to the server, and add a text link to this file to
       the report.


If the filename ends with '.zip':

  If the file is a zip file and contains the files 'ttclass2.cab' and 'ttclass2.zip':
       Extract the files contained in the zip file, and upload them to the
       server. Add the contained applet to the report.

  Else:
       Upload the file to the server, and add a text link to this file to
       the report.


If the filename ends with '.gif', '.png', '.jpg', '.jpeg' or .'bmp':
  Upload the image to the server and add it to the report.


Else:
  Upload the file to the server, and add a text link to this file to
  the report.


2. Handling of duplicates

If the file is not a zip-file:

   If the filename does not exist on the server:
     Upload the file to the server with the original name

   If the filename does exist on the server:
     Add a random six-digit number to the filename, and
     upload the file under the new name (Ex: 'mass.tt' -> 'mass123456.tt')


If the file is a zip-file:

   Add all the files it contains, overwriting any existent file, but add a
   new applet to the report.



The reason I overwrite the files in the last case, is that I can't start
renaming all the support files of the applet, and the overwritten files
will in general be common support files such as 'ttclass2.cab' and the
like.

Hope this sorts out any confusion,

Jesper


-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click