Up to [Local Repository] / interchange / lib / Vend
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
* Make date widget formatting shorthand apply to time widget as well.
* User widgets called time* are unaffected if they don't use a non-word
character in the callout.
* Examples:
time.ampm { type => 'time', ampm => 1 }
time.blank { type => 'time', blank => 1 }
time.8-23 { type => 'time', start_hour => 8, end_hour => 23 }
time.half { type => 'time', minutes => 'half_hourly' }
Various minor UTF-8 changes.
Correct attribution of &Vend::CharSet::display_chars (which is from
perluniintro manpage).
Enable localization of an error string.
Match content type more tightly in 2 spots ("text" is only trustworthy
in the MIME major type, not minor, and even that may be a stretch).
Simplify request method matching in a few places for readability and a
(trivial) performance benefit.
Use conventional $c lexical instead of $g for catalog hashref.
Fix tab/space differences to match context.
Update copyrights of files changed in 2008.
* Allow box-based option templates to access VALUE in addition to LABEL,
so the following is possible:
<img src="/images/{VALUE}.gif"> {LABEL}
* Add ability to set attrDefault for the Widget codedef type, which then transmits that to the opt hash prior to widget routine call. * Add new ynzero widget, which does a 1/0 yes/no for integer type fields. Uses the new attrDefault capability.
Allow for the proper display of product options that use text or textarea widgets by showing the actual value if a label doesn't exist for the value.
Pass applylocale option into Vend::Form::options_to_array in order to localize option labels (#80).
* Updated copyright headers to 2007 (closes bug #102) * Added GPL and copyright headers to a few files that were missing them.
New Free Software Foundation Address in headers of various files
New Free Software Foundation Address in headers of various files
Allow year_end to be less than year_begin so that years in the date widget can be shown in reverse order. Patch from Bill Carr. Thanks!
Fix broken HTML by prepending a space to class attribute. Found and fixed by Max Cohan <max@endpoint.com>.
In the date widget, if the date is blank (0000-00-00), treat a time of 00:00 as blank, not midnight, in the HTML option selection.
merged changes 2.64 vs 2.64.2.1 +++ 2.64.2.1 +++ don't use current time as default for date_blank
don't use current time as default for date_blank
Big copyright and version number update to prepare for 5.3.2 release.
date_blank widget: fixed wrong quoting
* More XHTML patches thanks to Toni Mueller.
- XHTML-compliance: - lowercased some HTML tags (all containers, so no ">" vs. "/>" issues) - removed double <small> tag ( <small><small>...text...</small></small> )
* Implement new AccumulateCode and TagRepository directives. The rationale
is:
-- There is a huge base of Interchange code, much of which is not
needed in even the standard catalog with full UI. This causes a
larger memory profile than necessary.
-- It is difficult to determine from the page code what code is
needed, especially when a [tag] can call a $Tag can call
a filter can call some sort of Action.
-- A feature is needed to allow building catalogs with a more
nearly optimal set of code than just "everything".
If AccumulateCode is no, operation is exactly as before. There have
been some code initialization changes and routine calling changes,
but the data structures are identical and no difference in operation
should be seen.
If you set AccumulateCode to "Yes" and specify a TagRepository that
contains all known UserTag, ActionMap, Filter, Widget, etc. etc.
code, Interchange starts accumulating and compiling these as
needed.
The code is sent to the master process for compilation and
incorporation, so that the next iteration of a page after HouseKeeping
seconds will find the code already compiled and ready to go.
It also copies the code file to the "code" (actually $Global::TagDir)
directory in the "Accumulated" subdirectory tree. When you restart
Interchange, these tags/filters/widgets/checks are read normally
and need not be recompiled on the fly.
Over time, as you access pages and routines, a full set of tags
will be developed and you can turn AccumulateCode to "No".
* There can be failures due to calling a $Tag from within embedded
Perl for the first time, particularly when it uses a MapRoutine or
calls another $Tag within. This is due to Safe, and there is probably
not much to be done about it. The good news is that the error should
go away after HouseKeeping seconds when the tag gets compiled by the
master.
This could be avoided in the case of an AllowGlobal catalog, and it
might be possible to make a directive that turns on AllowGlobal only
when in AccumulateCode mode.
The area, tmp, tmpn, and image tags are known to fail in this
way in the standard catalog. Tags that are frequently called
in this fashion should probably be placed in a "code/Vital"
directory and not be accumulated.
* This is only recommended for development -- it might
be possible to remove a tag/filter/etc. from the master
and recompile these on the fly, but I haven't looked at that
yet.
Another nice feature is that you can easily add a tag simply
by adding its code to the TagRepository and having it
compiled.
* WARNING: Nice features are often dangerous! Don't run this in
production -- you have been warned!
* WARNING: OrderCheck is not yet implemented, and a full audit has
not been done on all compiled code directives.
* WARNING: Not fully tested in Prefork mode, and really not intended for
that mode.
* WARNING: Including multiple tags in a file may have unpredictable
behavior. You should try to keep related Alias and tag things in
the same file.
* This feature only applies to Global code -- Catalog-based code
shows no change.
* Passes the regression tests 100% when called with an empty "code"
directory, compiling every tested tag and executing without error.
* We had been running without warnings so long, we had gotten a bit sloppy
in our code in some places.
Because we do lots of uninitialized hash member stuff with arrays
of fields and $opt, it is basically unreasonable for us to run with
the "use of uninitialized variable" warnings. Because we do a fair
amount of numerical comparisons on empty string values, it seemed
unreasonable to run with "string value in numeric gt" enabled.
Also, because Safe, HTML::Entities, and some other modules have
these checks enabled, page code is bound to have warnings issued
no matter what you do.
It seems better to run with some warnings enabled so that we can
catch bad code practice.
So I have made the code run without warnings prior to and after
interpolate_html(), and turned off warnings by default in the
page code.
If it is desirable to turn on warnings for pages, you can use
[pragma perl_warnings_in_page] and see warnings for that page
(or by default if you put in catalog.cfg).
* In general these changes are:
no warnings qw(uninitialized numeric);
in most pages.
* Add $::Pragma->{perl_warnings_in_page}.
* Remove defined checks when simple set tests will do.
* Streamline some code.
* Various variable initializations and tests to avoid warnings.
* Add nbsp=1 option to "links" widget. * Prevent empty mv_arg from being passed in URL automatically. * Add parser to handle links_nbsp.
Remove debug
* Just in case default widget is removed, provide default sub.
* Move all widgets out to code/Widget.
* Can specify multiple variants of widgets with something like:
CodeDef movecombo Widget 1
CodeDef movecombo Description Combo move
CodeDef movecombo Help Selects any/all of many options, puts in text box
CodeDef movecombo MapRoutine Vend::Form::movecombo
CodeDef movecombo_replace Widget 1
CodeDef movecombo_replace Description Combo move (one value)
CodeDef movecombo_replace Help Selects one of many options, puts in text box
Note the movecombo_replace variant has no Routine or MapRoutine.
It is parsed by the internal parser to type of movecombo with
option "replace".
Ideally we would be able to have a parser associated with each
type, specified outboard as well. I will work on this.
The major effect of this is that you can put anywhere:
CodeDef text_40 Widget 1
CodeDef text_40 Description Text box, 40 columns
This adds the entry to the widget type selector, but the parser
still makes it a { type => 'text', width => 40 }.
* Change the meta editor so that it uses a movecombo_replace
for the widget selector. This allows you to select a text
widget, but add the "_40" on manually to allow easy widget
specification.
* Add a movecombo_replace variant (i.e. { type => 'movecombo', replace => 1}
which calls a different mode of addItem to only allow one value
to be selected.
* Add Help capability to options generation. Uses Help member in CodeDef sections, and is automatically generated by codedef_options. * For use in widgets without that, you need to generate the options as a reference and use that. (I will think about a mechanism to allow that in metadata.) Illustration with previously generated options: [calc] %opts = ( ['foo', 'Foo', 'This is the Foo selection help'], ['bar', 'Bar', 'This is the Bar selection help'], ); return; [/calc] [display type=radio name=foobar options=`\%opts` ] <br> Or inline: [display type=select name=foobar options=`[ ['foo', 'Foo', 'This is the other Foo selection help'], ['bar', 'Bar', 'This is the other Bar selection help'], ]` ]
* Add Stefan's suggested Visibility modification for CodeDef options.
By default the visibility is public.
It wants something like:
codedef:JavaScriptCheck
Will return all public Descriptions.
codedef:JavaScriptCheck:private -- return public and private.
codedef:JavaScriptCheck:private,admin -- return public,private,admin
If Visibility is "with Foo::Bar", it checks to see if $Foo::Bar::VERSION
is true and returns the option if it is.
* Create routine to automatically select Routine for certain type of
CodeDef. Currently there are many separate methods of doing that.
This one prefers local over global, and is called with:
codedef_routine($type, $name);
For instance, codedef_routine('OrderCheck', 'multistate') will
return $Vend::Cfg->{CodeDef}{OrderCheck}{multistate} if it exists,
otherwise returns $Global::CodeDef->{OrderCheck}{multistate}.
* Modify Form.pm to use this for JavaScriptCheck. More will be
added.
* Modify filters to add private Visibility for non-mainstream filters.
* Modify meta editor to use this.
* Make the start of XHTML support for Interchange. * Add global XHTML and catalog XHTML options. Global is false/off by default, and catalog option is defaulted from global option. * The only effect is that Dispatch.pm sets $Vend::Xtrailer to the appropriate value of '/' or ''. * Use $Vend::Xtrailer to set any <br/> or <br> we use. * Change some generated HTML to: -- lowercase tags -- quote parms -- use $Vend::Xtrailer * Supply [br] tag which returns the proper <br/> or <br>.
* Add JavaScriptCheck member of CodeDef family. Used to generate
automatic Javascript-based field checks for [table-editor].
* Requires using the {prepend} member, so will not work with
[display] unless you use a template.
Remove debug
* Fix problem with standard catalog and "date_time_ampm" widget
definition, caused when "blank" handling was added.
* Modified freeform date widget parsing to operate more reliably.
* Added ability to have $opt->{start_hour} and $opt->{end_hour}
for times, i.e.
[display type=datetime_ampm start-hour=8 end-hour=17]
or
[display type="datetime_ampm_8-17"]
(parsed and removed before adjust time so ok there, tested)
* Add $opt->{minutes} types:
hourly -- Only even hour
half -- Even and half hour
tens -- every ten minutes
n,n,n -- The numbers mentioned (0,20,40 for example)
* Can all be added together:
[display type="datetime ampm hourly 8-17 +1 blank"]
* Passes all regression tests, tested exhaustively with UI.
* Add ExtraMeta capability to UserTags.
If you put an ExtraMeta setting in the CodeDef for the widget, it
works the same as a meta record of _widget::type, i.e. it is a structure
like this one for the "imagedir" widget:
CodeDef imagedir ExtraMeta <<EOM
{
_order => [ qw/ follow_symlinks / ],
follow_symlinks => {
widget => 'yesno',
label => 'Follow Symlinks',
help => 'Set to yes if you want to list all files, \
even following symbolic links',
},
}
EOM
This adds a "Special for imagedir widget" tab in the meta_editor,
which allows special settings for the widget.
Can be done in catalog.cfg widgets and global widgets. The actual
ExtraMeta is a string value which is runtime-interpolated to a
hash.
Can be set in Vend::Form native widgets by setting %Vend::Form::ExtraMeta,
i.e.:
$Vend::Form::ExtraMeta{text} = {
_order => [ 'maxlen' },
maxlen => {
widget => 'text_4',
label => 'Maximum length for value',
}
};
Not that it will do any good until the settings are honored by the
widget. Should be set to an actual reference.
There is an illustration for the "imagedir" widget as above.
* Add back in the nascent display_filter edit in meta_editor, and
give help/setting for restrict_allow.
filter_value isn't imported in this context
* Add code to allow control of class and style for date widget. Should probably be put in "select" type, too.
* Make hidden_text widget honor display_filter attribute, which allows a listed value like a timestamp to be filtered for a human readable date display.
* Allow individual profile checks defined in metadata.
It is defined in the "Help and Check" section of meta_editor.
IMPORTANT: To enable these checks, the ui_profile part of the overall
table definition has to be non-blank. You can just put a comment like
# Enable individual form profile checks
To enforce a profile on a field, set it's check value to a valid
IC profile check. For example, to make sure the length of a field
is between 4 and 10 characters, do:
length 4-10
Or to ensure it looks like a US or Canada postal code
postcode
This results in the following being set in the extended field
of mv_metadata:
{ check => 'postcode' }
If the check has an "=" sign anywhere, the field name is not
prepended. So to do multiple checks, you need to do
SECURITY:
Since the filter or lookup check type can do data lookups and potentially
call routines, we need to have some security. The table-editor tag
sets the scratch value "mv_individual_profile" when a ui_profile
is defined.
WITHOUT TABLE EDITOR:
To use this without the table editor, just set an mv_profile as
normal. Then for each individual check, define in the form:
<input type=text name=foo value="">
<input type=hidden name=mv_individual_profile value="foo=length 1">
That would check the form variable "foo" for a length of 1.
This is automatically done by the [display ...] tag, so you can
do:
[display type=text name=foo check="length 1"]
to do the same thing.
You will need to set the scratch value mv_individual_profile yourself
to enable these.
POSITIONING WITHIN PROFILE:
The facility works by modifying the first mv_form_profile run and
inserts its values either just before the first &fatal=yes or
*after* the first &update=yes, whichever comes first. If neither
are in the profile, they are put first in the profile.
MULTIPLE CHECKS:
If you have multiple mv_form_profile settings, the individual checks
are only run as a part of the first one and are not repeated.
* Add blank_default metadata setting, which is the value a field should
be initialized to (on display) if the current value has a length of 0.
* Remove extended.js_check from meta editor, as that was never implemented.
* Add some labels and help to meta editor.
* Tolerate leading whitespace in query.
* Tolerate leading whitespace in query.
* Allow setting of a disabled.param=1 entry so that you can show widgets in a table editor yet not accept data from them. The DISABLED=1 flag will be set in the widget (which normally grays it out) and it will be set to be display_only. * Pass the form and form_name parameters to Vend::Form for use in widgets.
allow date_widget to display/store empty value if called as date_blank datetime_blank etc.
* Don't HTML Entities encode the labels for a multi-option widget type if pre-filter=decode_entities. From a suggestion by Paul Vinciguerra.
* Fix minor bug found by Paul Vinciguerra. Just the kind of thing usually found only by code read...
Add display type "labels" that is like "options" except it displays the labels instead of their codes.
Two patches for lookup_query in mv_metadata: * Substitute for placeholders in query (just like with prepend and append): _UI_TABLE_ _UI_COLUMN_ _UI_KEY_ This allows foreign table lookup queries to be tailored for the record currently being edited in the table editor. * Avoid internal server error if query fails.
* Honor flag telling we already have data. * Honor "db" passed parameter in lookup_query.
* Fix several things with Table editor
-- Modified passing of {table} parameter in display for table editor,
setting flag to prevent getting table data twice.
-- Make lookup_query honor {db} parameter for selecting base table
for lookup
-- Lookup should now work internally to the table if no {db} spec'd
-- Sigh -- Mozilla screwed up their CSS size passing like MSIE, so
remove special things that made item editor/table editor automatically
look better on Mozilla (without setting *_height and *_width explicitly).
-- Added MAXLENGTH to things you can set in meta_editor
-- Added MAXLENGTH to parameters honored by [display ...]/Vend::Form,
without having to manipulate extra=" maxlength=22" stuff.
-- Put hooks in for auto-JS checks in table editor / [display]
* Other
-- Made default metadata (for merge) match foundation
The great copyright, email address, URL, and version update.
fixed comparison
allow empty values to be SELECTED
* Allow merge of passed and looked-up options when lookup_merge parameter is set. This allows a lookup for values in the table *plus* an options line, without duplicated entries. First use is to display widget types in Options -- allows setting of entries like "radio_left_5" without losing them at edit, while still providing canned options.
* Allow multiple semi-colon-separated queries to populate options via lookup_query.
* Allow table conglomerations of checkboxes and radio boxes with more than 9 columns (i.e. radio_right_10). Thanks to Bill Carr for finding.
Remove extra closing HTML tag '>' character. Thanks to Bill Carr for reporting this.
* Add widget and filter to allow direct upload of a file to a database
field. Useful for content/article bodies that you want to edit in a
file but that are inconvenient to clip-past into a textarea.
One new filter, "upload". Checks to see if the submitted variable
is a file upload, if it is it reads the file and places it in the
$CGI->{$varname}. Otherwise uses the value of the variable.
One new widget, "filetext". This is an <input type=file> followed
by a textarea. It shows the contents of the field in the textarea
and you can edit it. If you want to replace it with a file upload,
you just Browse to the file and upload it; it negates what is in
the textarea. If no file is uploaded, the textarea pertains (I guess
that statement is redundant).
The type=filetext widget should always be used in combination with two
filters, "nullselect upload".
* Allow templated options in select, radio, checkbox, etc. Enabled
by passing option_template="ATTR Template".
Uses same attr_list methodology as in most IC secondary templating.
Active keys:
LABEL The normal label value
VALUE The normal value
PRICE The formatted price, converted for locale
PRICE_NOFORMAT The raw price data
ABSOLUTE The formatted price, absolute (no negative)
NEGATIVE Set true if price data is negative
The default is equivalent to (though it doesn't use formatting):
{LABEL} {PRICE?}({PRICE}){/PRICE?}
This example:
{LABEL}
{PRICE?}
{NEGATIVE?}(subtract {ABSOLUTE}){/NEGATIVE?}
{NEGATIVE:}(add {PRICE}){/NEGATIVE:}
{/PRICE?}
Would turn:
Ebony handle ($20.00)
Wood handle
Plastic handle ($-5.00)
into:
Ebony handle (add $20.00)
Wood handle
Plastic handle (subtract $5.00)
* Fix "double March" bug in date widget.
updated LINUXIA branch to 4.9 sources in order to use it as testbed again
* Add intrinsic "file" widget type. * Allow setting of a widget class directly without using "extra".
* Add conditional_text option for fillin_combo type (which supports a common survey question type). It only shows the input text if there is more than a one-letter/digit response to the question.
* Add new widget type, "fillin_combo", for surveys. (It is a very common survey question need to have "select one of the above or comment below".) Produces a select box with the options and provides a text input below (by default a textarea 2 rows 60 cols). Used in combination with the nullselect filter, and the "other" option should be a blank value.
* Change form hrefs for [table-editor] so that it does not generate
"process" or "ui" by default. This will allow a URL restriction of
$Config->{VendURL}/admin/ to be effective. TODO: Change the forms in
pages/admin to not use [process].
The methodology is to use mv_nextpage as the form action and set
mv_action to the action, as well as mv_ui if the user is an admin.
* Add mv_ui CGI parameter to cause the 'ui' action to be performed
prior to process. This allows ui handling while still using mv_action.
To be debated -- setting mv_ui by default if $Vend::admin.
* Add handling of yesno_checkbox type so that you don't need to have
two checkboxes with one/zero and "yes/no".
* Add "default_widget" option which allows setting the default widget
for a field if none is specified.
* Fix {SEND} handling for nph output.
* Prevent insertion of $Variable->{MV_AUTOLOAD} on every interpolate_html.
* Allow extended handling of interpolation for append/prepend html
if $opt->{restrict_allow} is set in the table editor.
* Make option_format widget honor height.
Update Andrew Wilcox's email address at his request.
Big copyright date update. This will be the last time that Red Hat copyright notices get updated en masse, since the bulk of new code will very likely come from non-Red Hat employees.
* Change precedence of option source so that a lookup query will override passed options
Vend::Form * Change order of lookup queries in widgets so that they will be used even when a key is provided in the record. Vend::Interpolate * Fix [PREFIX-on-match] (and no-match) to work more than once with substitutions. * Add PREFIX-parent subtag to hash lists so you can access the parent item $opt in a list.
* Add option to allow ITL in form fields if needed.
* Fired what I think is a major blow in the ongoing escaping problems. Set up an ESCAPE_CHARS::std variable which encodes everything HTML::Entities normally does plus [. This should be used almost exclusively for encoding. * Fix encoding in most places it is done. * Fix a couple of default/override bugs in Vend/Form.pm at the same time. * Add a "admin/test_code.html" page for testing short snippets of ITL without having to create a test page. * Make the table populator JavaScript honor the db tables the particular admin user is supposed to see.
* Honor XML-style empty container tags. [set name="foo"/] is equivalent to [set name="foo"][/set] If you are going to use this, you MUST name the parameters, and you SHOULD quote them. [set foo /] ---> Never works [set name=foo/] ---> Does not work [set name=foo /] ---> Works but not recommended [set name="foo" /] ---> Recommended [set name="foo"/] ---> OK Benefits of this are removing a call to parse empty buffers, and it should not add significant overhead. * Fix a couple of default setting problems in Form.pm.
* Fix Vend::Form bug which caused a default "1" to show up in many widgets. * Check for existence of record before runnin fatal $s->row() in set_slice for DBM databases.
* Fix problem with $Tag->display() called with null table, affecting "wizard" mode. * Re-introduce "restrict" tag into Interchange, unintentionally omitted when the great tag move was made. * Clean up of [sql ...] tag, which now becomes useful as a way of doing [query list=1 ...]. * Give proper encoding behavior to [display type=value ...] * Fix bad status code on PGP failure.
* Recognize explicit "multiple" type.
* Create Vend::CounterFile module and use it for counters. This allows us to use/honor Fcntl lock settings and improve reliability on shared sessions.
* Bad template for movecombo caused failure of javascript move.
The POSIX::strftime usage without a "use" was causing expireall to fail.
* Continuing work on meta_display and Vend::Form. --- Relocated date and option widgets --- Prepared for breaking out image widgets to code/Widget --- Fixed various bugs in widgets --- Code simplification in Primitive.pm --- Fix widget.coretag to not call UI::Primitive routine --- Redo option_format filtering * Intermediate changes in page editor usertag support, preparing to move to module * Improve alias_table code in interchange.PL
* Make Vend::Form live. Now passes all known tests, and runs accessories/widgets (apparently) flawlessly in foundation, barry, simple, and the UI. * Remove tons of redundant code from Vend::Interpolate. * Add the first outboard system filter. * Change catalog.cfg to highlight etc/after.cfg. * Add a couple more regression tests for widgets. * More to come, UI::Primitive will soon be widget-free....
* Changes to make [item-accessories ...] and [item-options ...] work on flypage/loop as well as in cart. * Fix dropdown/select defaults applied with asterisk. * Fix price data insert for [item-options].
* Fix behavior when $ishash, i.e., called from [item-accessories ...] or [item-options], making those work in Vend::Form. * Fix include.coretag so that the $locale is not defined by default -- this was causing [L] ... [/L] to show up when called with positional parameters. (Problem was using $_[1].)
* Add new Vend::Form module which will get rid of the tag_accessories gunk and replace UI::Primitive::meta_display eventually. Emulates current widget set (mostly). * To test it out, define Variable MV_DANGEROUS_NEW_FORM 1 in either catalog.cfg or interchange.cfg. * Todo: - add imagehelper/datetime/image - verify with [item-options ...] and [item-accessories ...] - add better lookup - Implement custom widgets with "CodeDef mywidget Widget"