[interchange-cvs] interchange - racke modified 2 files
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Fri Sep 26 12:27:41 UTC 2008
User: racke
Date: 2008-09-26 12:27:41 GMT
Modified: . WHATSNEW-5.7
Modified: code/UserTag capture_page.tag
Log:
scratch attribute added to [capture-page] to store the resulting page in a
scratch variable, supplied by Phil Smith.
explicit check for hide attribute removed
Revision Changes Path
2.12 interchange/WHATSNEW-5.7
rev 2.12, prev_rev 2.11
Index: WHATSNEW-5.7
===================================================================
RCS file: /var/cvs/interchange/WHATSNEW-5.7,v
retrieving revision 2.11
retrieving revision 2.12
diff -u -r2.11 -r2.12
--- WHATSNEW-5.7 21 Sep 2008 11:40:27 -0000 2.11
+++ WHATSNEW-5.7 26 Sep 2008 12:27:40 -0000 2.12
@@ -46,6 +46,9 @@
* [run-profile] removes automatically generated profiles only.
+* scratch attribute added to [capture-page] to store the resulting page in a
+ scratch variable, supplied by Phil Smith.
+
OrderCheck
----------
1.10 interchange/code/UserTag/capture_page.tag
rev 1.10, prev_rev 1.9
Index: capture_page.tag
===================================================================
RCS file: /var/cvs/interchange/code/UserTag/capture_page.tag,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- capture_page.tag 30 Mar 2007 23:40:56 -0000 1.9
+++ capture_page.tag 26 Sep 2008 12:27:41 -0000 1.10
@@ -1,23 +1,40 @@
-# Copyright 2003-2007 Interchange Development Group and others
+# Copyright 2003-2008 Interchange Development Group and others
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. See the LICENSE file for details.
#
-# $Id: capture_page.tag,v 1.9 2007-03-30 23:40:56 pajamian Exp $
+# $Id: capture_page.tag,v 1.10 2008-09-26 12:27:41 racke Exp $
UserTag capture_page Order page file
UserTag capture_page addAttr
-UserTag capture_page Version $Revision: 1.9 $
+UserTag capture_page Version $Revision: 1.10 $
UserTag capture_page Routine <<EOR
sub {
my ($page, $file, $opt) = @_;
- # check if we are allowed to write the file
- unless (Vend::File::allowed_file($file, 1)) {
- Vend::File::log_file_violation($file, 'capture_page');
- return 0;
+ # check if we are using a file
+ if ($file) {
+ # check if we are allowed to write the file
+ unless (Vend::File::allowed_file($file, 1)) {
+ Vend::File::log_file_violation($file, 'capture_page');
+ return 0;
+ }
+
+ if ($opt->{expiry}) {
+ my $stat = (stat($file))[9];
+
+ if ($stat > $opt->{expiry}) {
+ if ($opt->{touch}) {
+ my $now = time();
+ unless (utime ($now, $now, $file)) {
+ ::logError ("Error on touching file $file: $!\n");
+ }
+ }
+ return;
+ }
+ }
}
if ($opt->{scan}) {
@@ -26,26 +43,22 @@
$::Scratch->{mv_no_count} = 1;
- if ($opt->{expiry}) {
- my $stat = (stat($file))[9];
+ my $pageref = Vend::Page::display_page($page,{return => 1});
+ Vend::Interpolate::substitute_image($pageref);
- if ($stat > $opt->{expiry}) {
- if ($opt->{touch}) {
- my $now = time();
- unless (utime ($now, $now, $file)) {
- ::logError ("Error on touching file $file: $!\n");
- }
- }
- return;
- }
+ my $retval;
+
+ if ($opt->{scratch}) {
+ $::Scratch->{$opt->{scratch}} = $$pageref;
+ $retval = 1;
}
- my $pageref = Vend::Page::display_page($page,{return => 1});
- Vend::Interpolate::substitute_image($pageref);
+ if ($file} {
+ $retval = Vend::File::writefile (">$file", $pageref,
+ {auto_create_dir => $opt->{auto_create_dir},
+ umask => $opt->{umask}});
+ }
- my $retval = Vend::File::writefile (">$file", $pageref,
- {auto_create_dir => $opt->{auto_create_dir},
- umask => $opt->{umask}});
- return $opt->{hide} ? '' : $retval;
+ return $retval;
}
EOR
More information about the interchange-cvs
mailing list