MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

MiniVend 3.12 close to release



******    message to minivend-users from mikeh@minivend.com     ******

Dear All,

My dream of a small release is certainly over by now. But I think
I am getting there....

I went ahead and added a fairly good file upload to MiniVend, at least
I think it is OK. I put an application in the pages/reconfig directory.
The [value-extended ...] tag to access it all is documented as well;
for convenience I appended that to this message.

Because of that, I figured I should do a rework of the UserDB password
situation and they are now encrypted by default in the demo.  If enough
people feel strongly about this I will add the Variable MV_NO_CRYPT 1
as the default.

I think I have squashed all of the reported bugs, but if you had
one that is not fixed please let me know.

-- 
Mike Heins                          http://www.minivend.com/  ___ 
                                    Internet Robotics        |_ _|____
Be patient. God isn't               131 Willow Lane, Floor 2  | ||  _ \
finished with me yet.               Oxford, OH  45056         | || |_) |
 -- unknown                         <mikeh@minivend.com>     |___|  _ <
                                    513.523.7621 FAX 7501        |_| \_\

=head2 Extended Value Access and File Upload

MiniVend as of 3.12 has a facility for greater control over the display
of form variables; it also can parse C<multipart/form-data> forms for
file upload. 

File upload is simple. You define a form like:

    <FORM ACTION="[process-target] METHOD=POST ENCTYPE="multipart/form-data">
    <INPUT TYPE=hidden NAME=mv_todo VALUE="return">
    <INPUT TYPE=hidden NAME=mv_nextpage VALUE="test">
    <INPUT TYPE=file NAME=newfile>
    <INPUT TYPE=hidden NAME=testvar VALUE="value0">
    <INPUT TYPE=hidden NAME=testvar VALUE="value1">
    <INPUT TYPE=hidden NAME=testvar VALUE="value2">
    <INPUT TYPE=submit VALUE="Go!">
    </FORM>

The [value-extended ...] tag allows access to all of these things.
If you put on the C<test.html> page and use with the above form
you can see how it is used:

    <PRE>
    testvar element 0: [value-extended name=testvar index=0]
    testvar element 1: [value-extended name=testvar index=1]
    testvar elements:
     joined with a space:   |[value-extended name=testvar]|
     joined with a newline: |[value-extended
                                joiner="\n"
                                name=testvar
                                index="*"]|
     first two only:    |[value-extended
                                name=testvar
                                index="0..1"]|
     first and last:    |[value-extended
                                name=testvar
                                index="0,2"]|
    Uploaded file name: [value-extended name=newfile]
    Is newfile a file? [value-extended name=newfile yes=Yes no=No test=isfile]
 
    Write the file. [value-extended name=newfile outfile=junk.upload]
    Write again with
     indication: [value-extended name=newfile
                                outfile=junk.upload
                                yes="Written."]
                                no=FAILED]
 
    And the file contents:
    [value-extended name=newfile file_contents=1][/comment]
    </PRE>

The syntax for C<[value-extended ...]> is:

 named: [value-extended 
            name=formfield
            outfile=filename*
            ascii=1*
            yes="Yes"*
            no="No"*
            joiner="char|string"*
            test="isfile|length|defined"*
            index="N|N..N|*"
            file_contents=1*
            elements=1*]

positional: [value-extended name]

HTML examples:

   No match found for <PARAM MV="value-extended"
   						MV.JOINER=" and "
   						MV.NAME=mv_searchspec>
   <INPUT TYPE="text" NAME="mv_searchspec"
        VALUE="[value-extended name=mv_searchspec index=0]">
   <INPUT TYPE="text" NAME="mv_searchspec"
        VALUE="[value-extended name=mv_searchspec index=1]">

Expands into the current value of the customer/form input field named
by field. If there are multiple elements of that variable, it will return
the value at C<index>; by default all joined together with a space.

If the variable is a file variable coming from a multipart/form-data
file upload, then the contents of that upload can be returned to the 
page or optionally written to the C<outfile>.

=over 4

=item name

The form variable NAME. If no other parameters are present, then the 
value of the variable will be returned. If there are multiple elements,
then by default they will all be returned joined by a space. If C<joiner>
is present, then they will be joined by its value.

In the special case of a file upload, the value returned is the name
of the file as passed for upload.

=item joiner

The character or string that will join the elements of the array. Will
accept string literals such as "\n" or "\r".

=item test

Three tests -- C<isfile> returns true if the variable is a file upload.
C<length> returns the length. C<defined> returns whether the value
has ever been set at all on a form.

=item index

The index of the element to return if not all are wanted. This is
useful especially for pre-setting multiple search variables. If set
to C<*>, will return all (joined by C<joiner>). If a range, such
as C<0 .. 2>, will return multiple elements.

=item file_contents

Returns the contents of a file upload if set to a non-blank, non-zero value.
If the variable is not a file, returns nothing.

=item outfile

Names a file to write the contents of a file upload to. It will not
accept an absolute file name; the name must be relative to the catalog
directory. If you wish to write images or other files that would go to
HTML space, you must use the HTTP server's C<Alias> facilities or 
make a symbolic link.

=item ascii

To do an auto-ASCII translation before writing the C<outfile>, set
the C<ascii> parameter to a non-blank, non-zero value. Default is no
translation.

=item yes

The value that will be returned if a test is true or a file is
written successfully. Defaults to C<1> for tests and the empty
string for uploads.

=item no

The value that will be returned if a test is false or a file write
fails. Defaults to the empty string.

=back
-
To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list


Search for: Match: Format: Sort by: