Bug 367 - optional compress format in ExtractWFSData
: optional compress format in ExtractWFSData
Status: RESOLVED FIXED
: Chameleon
Widget
: 1.99
: PC Windows 2000
: P2 enhancement
: FUTURE
Assigned To:
:
:
:
:
: 429
  Show dependency treegraph
 
Reported: 2004-05-01 10:47 by
Modified: 2005-05-27 08:20 (History)


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2004-05-01 10:47:11
We made some changes to the ExtractWFSData widget in order to have it support 
the WinZip format next to the tar.gz format for download. Our customer's 
intranet is completely Windows based and the workstations there don't have a 
utility installed to unpack tar.gz files, that's why they wanted WinZip 
compression format.

Through this enhancement bug I am trying to find out if DM Solutions would be 
interested of incorporating these changes into the Chameleon CVS distribution.

I think there could be 2 options for this:
1. have a compress select box in the dialog so that the user can choose
2. have a widget attribute determine which compress format to use

In which I am in favour of the no. 1 option because of greatest flexibility.
------- Comment #1 From 2004-05-03 08:07:37 -------
Hi Bart, we're always willing to look at incorporating user contributed
enhancements to Chameleon, it's always a question of time.  If you want to send
me the code, I'll take a look at it and see if it could be added when time
permits.  

I agree that option 1 is the better way to go and would be just as easy to
program as option 2.
------- Comment #2 From 2004-05-21 10:17:03 -------
Set Target Milestone to 1.99 Final
------- Comment #3 From 2004-06-21 03:19:51 -------
Hi Bill,

I have a few questions about this one:

-now there is an option in the widget to get a tar or to get a tar.gz file 
(compress checkbox). If you compare this to WinZip, the .zip format 
is "equivalent" to the tar.gz format (there is not just archive option with 
WinZip). Is it possible that we remove the optional compress checkbox and give 
the user the choice between zip or tar.gz? Anyways, we should be encouraging 
people to download compressed content, especially with shapefiles or GML, they 
compress well.

-the Zip will introduce dependency on the PEAR Zip.php file. Would you want to 
add this one to the common directory? Or what are your policies with shared 
libraries?

If we get consensus on the way to do this, I am willing to take this one on me.
------- Comment #4 From 2004-06-21 10:03:30 -------
Bart,

Is the PEAR Zip.php file the only file required?  i.e.  Does this file require
other PEAR modules to be installed?  I ask this because we ran into a similar
thing with the PEAR tar file.  It had interdependancies on other PEAR modules.
------- Comment #5 From 2004-06-21 10:10:10 -------
Hi Bill,

the only dependency I see in the file is:

require_once 'PEAR.php';
------- Comment #6 From 2004-06-21 10:41:15 -------
I was afraid that there would be a dependency like that.  The widget would
require PEAR to be installed in order to work.  To the best of my knowledge,
Chameleon does not have any widgets that depend on PEAR.  That being said, there
are discussions going on that might require PEAR dependencies in Chameleon in
the future.

I'd like to get Paul's input on where he sees Chameleon going in the future
before commiting these changes to CVS.

------- Comment #7 From 2004-06-21 10:57:42 -------
Bill, I tried the same approach as you guys did in the tar.php file, just
comment out the require_once and it still works. So maybe it could work like this.

//require_once 'PEAR.php';
------- Comment #8 From 2004-06-21 12:23:06 -------
Perfect, if it works that way then I don't see a problem with it.  Move it to
the common folder then.  I'll give it a try when I get a chance.
------- Comment #9 From 2004-06-21 15:08:31 -------
The changes are in CVS, took me some revisions though because of some apparent 
conflict. I have tested and it still works. Anyway, I hope I am used to the CVS
stuff now ...

Needs to be done: put zip.php in common/zip/

For docs in future:
Added attribute compressformats, possible options ZIP and TGZ.

<cwc2 type="ExtractWFSData" styleresource="NavButton" visible="true"
image="/ms4w_20/apps/chameleon/htdocs/images/tool_extract_off.png"
imagetip="Download shapefile of GML" imagewidth="24" imageheight="24"
popupwidth="450" popupheight="300" toolbar="false" status="false"
menubar="false" outputformats="Shape,GML" compressformats="ZIP,TGZ" >
    <image state="normal"/>
    <image state="hover"/>
</cwc2>

Let me know if there is any problem with tabs or line feeds ...
------- Comment #10 From 2004-06-22 10:13:52 -------
Copying my comment from bug 429:

Why is compressformats a required attribute?  It seems to me that it would be
better to simply assume no compression if the attribute is not set?
------- Comment #11 From 2004-06-22 10:58:16 -------
Daniel, this was an oversight in the design.  The original requirements for the
widget were to download a compressed verion, the decision was made at design
time to allow the user to download the uncompressed format if they wanted.

As Bart said, it would require a number of changes.  This is because the
compression format is firmly tied to the GUI.

I do agree that it could be made an optional component.
------- Comment #12 From 2004-06-22 14:40:26 -------
My opinion is that any parameter should be made optional unless it's not
possible to set a proper default value and behavior for it. If you don't do that
then you end up with widgets that are a pain to configure because they carry
lots of useless required parameters that always have the same value.  

However Paul is the main architect so I'll let him make the final call.
------- Comment #13 From 2004-07-05 14:15:51 -------
There is some confusion in the last couple of comments.  compressformats does
not control compression or no compression, it controls the list of available
compression formats available to the user.

The Chameleon solution to this problem is to make compressformats optional with
the default being all available compression formats.  For instance, in the code
for the widget we would declare a member variable mszCompressFormats with a
default value of "zip,tgz,tar" so that if the template designer did not provide
the compressformats attribute in the widget, a legal and useful value will be
used (which is to provide all available compression formats).  Then in the case
of building an application for a specific client such as Bart's, the template
designer could include compressformats="zip" so that only ZIP is listed as a
valid compression format.

The real solution is to remove compressformats and add subtags to list the
compression formats.  Specifically, the compression checkbox would be removed
and the list would be formed from subtags like:

<format name="zip" type="zip" default="true"/>
<format name="compressed tar" type="tgz" default="false"/>
<format name="no compression" type="none" default="false"/>
...

with no formats listed, the default list would appear (none, zip, tgz, tar). 
When formats are listed, then they would be used instead.  This would allow
complete control over the presentation and setting of the default option etc.
------- Comment #14 From 2004-07-06 02:16:19 -------
Paul, I agree with your comments. But the same would apply to outputformats I
guess.

In your comments you one time opt for a list of 3 options, and another time for
4 options. As the outputformat (GML, shape) determines the number of files, I
would opt for just 3 formats (tar, zip and tgz), just tar even if there is one
file (for consistency). What do you think? Otherwise, what would the
application
do if somebody selects compress format "none" and outputformat "shapefile"?

1. none
2. zip
3. tgz
4. tar

Let me know if you want me to fix this and when.
------- Comment #15 From 2004-07-07 12:01:29 -------
good catch, you are correct that we should add tags for output formats as well.

so the new proposal is:

<outputformat .../>
<compressionformat .../>

available output formats are dependent on OGR-supported formats, but for now are
limited to shapefile and GML

available compression formats are TAR, TGZ, and ZIP.

I agree that it makes sense to enforce compression, so how about we drop TAR and
use either TGZ or ZIP as compression formats?

As a note, the use of subtags allows us more flexibility in defining future
compression (bzip, bzip2, lzw, ...) formats and OGR output formats.

Bart, you can implement this if you have the time, since it is important for
your clients.
------- Comment #16 From 2004-07-19 06:43:11 -------
All changes are in CVS now. Files changed:
-ExtractWFSData.php
-ExtractWFSData.phtml
-ExtractWFSData.widget.php

Done:
-Compressformat renamed to compressionformat.
-Made value comparison case-insensitive.
-Implemented outputformat and compressionformat as arrays instead of
comma-separated string attributes
-provided default values in the code (Shape and GML for output, TGZ and ZIP for
compression).
-if only one format is provided in the template, the value is not read from a
select list but from a hidden form field.
-options now use css class inputList
											<cwc2 type="ExtractWFSData" ...>
  <outputformat value="Shape" />
  <outputformat value="GML" />
  <compressionformat value="ZIP" />
</cwc2>

TODO: update widget documentation when format is defined.
------- Comment #17 From 2004-08-10 20:44:34 -------
Changed Target to FUTURE.
------- Comment #18 From 2005-05-27 08:20:17 -------
This has been fixed a while ago.