Download Manager First draft - finally
Hi Folks,
I felt this was probably a more appropriate forum for this, rather
than cluttering up JQuery UI with it.
Also, congratulations on getting 1.1.4 out. I'll be checking it out
later. It's going to break my treetable, but I'm glad, .slice() seems
so much more intuitive to me.
I now have my ideas fleshed out in code. What I thought would be a
nice weekend project turned out to be not such a trivial project after
all. When you see the code, you'll wonder what the hell took so long,
but this is about the sixth iteration. Packer.php is very slow, and
JSMin.php breaks on the regii, so I tried a few workarounds, and then
cut it back to get the code up, get your feedback, and take it from
there.
I've split it up into two files, one for CSS and one for JS. I did
this because they'll need different functionalities. I'm guessing that
the main CSS will be contained in a "theme" file with individual
widget styles added in afterwards, whereas jszip will have jquery as
its core with widget plugins added as required.
So basically, to get jquery and any number of plugins, it's just
specified in the script src tag, like so, script src="jszip.php?
p[]=metadata&p[]=tabs&p[]=multiplefile&p[]=jQTreeTable" etc. There is
an optional param, base, in case a core other than jquery is required
(handy for testing).
The script then looks for the preminified files, and if it doesn't
find them, it gets the unminified ones, minifies them, and stores
them. It adds them all one after the other, gzips them and outputs
them to the browser with an expires header 7 days into the future
(Thanks for the tip, Paul). The csszip file is basically a clone of
the jszip one, which I'll adapt once I know how it should deliver the
content.
OK, it's very basic, and I expect to have to make a lot of changes to
it, but at least there is something to work with, and get your
feedback on.
Issues are, my minifying is very conservative, mainly because I
haven't yet been able to devise a regex to strip out one line comments
(without it thrashing the regii in the core (will probably have to do
a look-behind regex, which I haven't done before)). It also doesn't
crunch up spaces between words.
If I can get this, I should be able to remove that part from
Packer.php, which should result in significantly faster packing, but
for the moment it doesn't pack at all. It gzips blindingly quick,
however.
With all the widgets that are planned for JQueryUI, it is likely that
there is going to be code needed to make some widgets play together
nicely, which won't necessarily go into the plugins themselves. This
might be a way to inject that code into the file that gets delivered.
I'll probably put it up in the plugin repository after the weekend,
but you can go to http://www.hanpau.com/jquery/DownloadManager.zip ,
if you'd like to have a look at it. You can also see it working at
http://www.hanpau.com/jquery/unobtrusivetreetable.php and at
http://www.hanpau.com/jquery/upload.php (uses multiplefile plugin).
Let me know what you think. Have a great weekend.
Paul.