Skip to content

Commit

Permalink
* 5 more filters documented
Browse files Browse the repository at this point in the history
* 1 filter partly

(And a commit log from a previous commit):

* bin/coup: fix error 'bad fd number' that sometimes appeared
* docbook/literals.ent: Quickbooks entity &QBOOKS;
* refs/compatible_5_2: mark obsolete
* refs/date_change.filter: small improvement in example and layout
  • Loading branch information
docelic committed Mar 21, 2006
1 parent f78183f commit de74963
Show file tree
Hide file tree
Showing 6 changed files with 238 additions and 0 deletions.
27 changes: 27 additions & 0 deletions refs/acl2hash.filter
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
__NAME__ purpose
convert Interchange ACL string to a Perl hash representation
__END__


__NAME__ see also
acl, hash2acl
__END__


__NAME__ description
The filter is specific to the ACL widget and
probably should not be used otherwise.
</para><para>
The filter doesn't need to be selected for the widget to
operate in the &tag-table-editor;.
__END__


__NAME__ online: Filter example
<programlisting>
</programlisting>
__END__

__NAME__ missing
Better description
__END__
74 changes: 74 additions & 0 deletions refs/date_change_null.filter
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
__NAME__ purpose
convert MMDDYYYY date (possibly with specified time) to YYYYMMDDhhmm, with NULL for missing dates
__END__


__NAME__ see also
date2time
__END__


__NAME__ description
The filter replaces date specification in form of
</para><para>
<literal><replaceable>MM</replaceable>[/-]<replaceable>DD</replaceable>[/-]<replaceable>YY(YY)?</replaceable>(:<replaceable>hh</replaceable>(<replaceable>mm</replaceable>)?)?</literal>
</para><para>
or
</para><para>
<literal><replaceable>YYYY</replaceable>[/-]<replaceable>MM</replaceable>[/-]<replaceable>DD</replaceable>(:<replaceable>hh</replaceable>(<replaceable>mm</replaceable>)?)?</literal>
</para><para>
to
</para><para>
<literal><replaceable>YYYYMMDD</replaceable>((<replaceable>hh</replaceable>)?(<replaceable>mm</replaceable>)?)?</literal>.
</para><para>
If the year specification contains 2 digits only and is less than
<literal>50</literal>, as is say, <literal>02</literal>,
then it is treated as an offset from year <literal>2000</literal>, and not
<literal>1900</literal>. In other words, <literal>05</literal> is understood
as year <literal>2005</literal>, <literal>80</literal> is understood as year
<literal>1980</literal>.
</para><para>
Time specification unspecified in input get omitted from output as well.
</para><para>
This filter is similar to &filter-date-change;, but is meant for use with
databases such as &PGSQL; that do not accept
invalid dates (the '0000-00-00' used in the &filter-date_change;), but
require <literal>NULL</literal> to indicate absence of a date.
__END__


__NAME__ notes
For more information on &PERL; Regular Expressions, pattern matching and
character classes, see
<citerefentry><refentrytitle>perlre</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
</para><para>
The filter is most commonly used with date selection fields.
</para><para>
If only two out of four time digits are specified, then due to the operation
of the <function>sprintf()</function> function, they tend to indicate minutes
and not hours!
</para><para>
When the input data starts with year specification, the year must have
4-digit format (i.e. <literal>2005</literal> and
<emphasis role='bold'>not</emphasis> just <literal>05</literal>)!
__END__

__NAME__ online: Using date_change_null
<programlisting><![CDATA[
[filter date_change_null]2005-01-01[/filter] <br/>
[filter date_change_null]2005/01/01[/filter] <br/>
<br/>
[filter date_change_null]2005-01-01:10[/filter] <br/>
[filter date_change_null]2005/05/29:1536[/filter] <br/>
<br/>
[filter date_change_null]05-29-2005:1536[/filter] <br/>
[filter date_change_null]05-29-05:1536[/filter] <br/>
<br/>
[filter date_change_null]0000-00-00[/filter] <br/>
[filter date_change_null][/filter] <br/>
]]></programlisting>
__END__

__NAME__ missing
Example from real date widget (use widget "date_blank", filter "date_change_null", and optionally set the default value to "0000-00-00" )
__END__
27 changes: 27 additions & 0 deletions refs/hash2acl.filter
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
__NAME__ purpose
convert Interchange ACL hash to string representation
__END__


__NAME__ see also
acl, acl2hash
__END__


__NAME__ description
The filter is specific to the ACL widget and
probably should not be used otherwise.
</para><para>
The filter doesn't need to be selected for the widget to
operate in the &tag-table-editor;.
__END__


__NAME__ online: Filter example
<programlisting>
</programlisting>
__END__

__NAME__ missing
Better description
__END__
38 changes: 38 additions & 0 deletions refs/lookup.filter
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
__NAME__ purpose
perform lookup in another database
__END__


__NAME__ see also
__END__


__NAME__ description
The filter performs a lookup in another database.
</para><para>
See <xref linkend='lookup_examples'/> for clarification.
__END__


__NAME__ example: Filter example
Suppose we have two databases, <database>products</database> and
<database>support</database>, as follows:
<screen>
code price description
144 12 Item 144
145 84 Item 145
146 314 Item 146
</screen>
and
<screen>
code product_supported
144 0
145 1
146 -1
</screen>
</para><para>
Then, performing
<code>[filter lookup.support.product_supported]144[/filter]</code> would
yield <literal>0</literal>.
__END__

50 changes: 50 additions & 0 deletions refs/next_sequential.filter
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
__NAME__ purpose
perform lookup in another database
__END__


__NAME__ see also
__END__


__NAME__ description
__END__


__NAME__ example: Filter example
__END__


* Add new filter, "next_sequential". Allows selection of a next-sequential
value based on a field (and qualified by a field).

[filter op=3D"next_sequential.survey_q.sort"][cgi sort][/filter]

will:

1. Return the existing value if present.
2. If existing value is blank, return max + 1 in the sort field,
i.e. equivalent to:

SELECT sort FROM survey_q
ORDER BY sort DESC
LIMIT 1

If another argument of a field name is passed, i.e.

filter =3D> 'next_sequential.survey_q.sort.sel',

then you get:

SELECT sort FROM survey_q
WHERE sel =3D '[cgi sel]'
ORDER BY sort DESC
LIMIT 1

This allows a next-sequential numbering for things that need it.

Developed to support general-purpose survey UI for Ton's excellent
product rating system.



22 changes: 22 additions & 0 deletions refs/qb_safe.filter
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
__NAME__ purpose
make input safe for QuickBooks by removing unfriendly characters
__END__


__NAME__ see also
__END__


__NAME__ description
The filter makes data safe for &QBOOKS;, because
QB will crash at the drop of a hat.
__END__


__NAME__ example: Filter example
&filter-qb_safe; the input and limit it to 25 characters.
<programlisting>
[filter op="qb_safe 25" interpolate=1][ol-param sku][/filter]
</programlisting>
__END__

0 comments on commit de74963

Please sign in to comment.