From: Chris W. <la...@us...> - 2004-11-24 14:16:11
|
Update of /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/TT2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19555/lib/OpenInteract2/TT2 Modified Files: Plugin.pm Log Message: add 'add_params_to_url()' to OI2::URL and a pointer to it from OI2::TT2::Plugin; plus tests Index: Plugin.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/TT2/Plugin.pm,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Plugin.pm 24 Oct 2004 16:17:29 -0000 1.14 --- Plugin.pm 24 Nov 2004 14:16:01 -0000 1.15 *************** *** 342,345 **** --- 342,350 ---- my $U = OpenInteract2::URL->new(); + sub add_params_to_url { + my ( $self, $url, $p ) = @_; + return $U->add_params_to_url( $url, $p ); + } + sub make_url { my ( $self, $p ) = @_; *************** *** 705,708 **** --- 710,717 ---- Item: [% OI.html_decode( news.news_item ) %] + # Add parameters to an existing URL + [% display_no_template_url = OI.add_params_to_url( my_path, no_template = 'yes' ) %] + <a href="[% display_no_template_url %]">View Printable</a> + # Works, but not as useful... [% edit_url = OI.make_url( BASE = '/User/show/', user_id = OI.login.user_id, *************** *** 1171,1174 **** --- 1180,1191 ---- <p>This is the first paragraph</p> + B<add_params_to_url( $url, \%params )> + + Delegates to L<OpenInteract2::URL> for C<add_params_to_url()> which + just adds the key/value pairs in C<\%params> to C<$url>, adding a + query separator if necessary and doing any escaping of the + paramters.. Note that C<$url> is already presumed to be contextualized + (under the correct deployment context) and will not be escaped. + B<make_url( \%params )> |