[interchange-cvs] interchange - racke modified dist/lib/UI/pages/include/page_save_old
interchange-core@interchange.redhat.com
interchange-core@interchange.redhat.com
Tue May 21 11:28:01 2002
User: racke
Date: 2002-05-21 15:27:41 GMT
Modified: dist/lib/UI/pages/include Tag: STABLE_4_8-branch
Modified: page_save_old
Log:
allow save of a page even if the page has no signatures like the ones in the
foundation catalog like UI_CONTENT etc.
Revision Changes Path
No revision
No revision
2.0.2.1 +28 -18 interchange/dist/lib/UI/pages/include/Attic/page_save_old
rev 2.0.2.1, prev_rev 2.0
Index: page_save_old
===================================================================
RCS file: /anon_cvs/repository/interchange/dist/lib/UI/pages/include/Attic/page_save_old,v
retrieving revision 2.0
retrieving revision 2.0.2.1
diff -u -r2.0 -r2.0.2.1
--- page_save_old 18 Jul 2001 02:22:11 -0000 2.0
+++ page_save_old 21 May 2002 15:27:41 -0000 2.0.2.1
@@ -32,24 +32,26 @@
else {
$def_string = $CGI->{ui_short_definition};
}
- $def_string =~ s/\r\n?/\n/g;
- unshift @layout, '[' . "comment]\n$def_string\n[" . "/comment]\n";
+ if (@layout) {
+ $def_string =~ s/\r\n?/\n/g;
+ unshift @layout, '[' . "comment]\n$def_string\n[" . "/comment]\n";
- foreach $one (@layout) {
- if( $one eq 'UI_CONTENT') {
- my $content = shift @insert;
- $content =~ s/\r?\n/\n/g;
- $content = "\n<!-- BEGIN CONTENT -->\n$content\n<!-- END CONTENT -->\n";
- #Log("inserting $content");
- push @out, $content;
- }
- elsif ($one =~ /^[A-Z]\w+$/) {
- push @out, '@_' . $one . '_@';
- #Log("inserted variable $one");
- }
- else {
- push @out, $one;
- #Log("inserted set $one");
+ foreach $one (@layout) {
+ if( $one eq 'UI_CONTENT') {
+ my $content = shift @insert;
+ $content =~ s/\r?\n/\n/g;
+ $content = "\n<!-- BEGIN CONTENT -->\n$content\n<!-- END CONTENT -->\n";
+ #Log("inserting $content");
+ push @out, $content;
+ }
+ elsif ($one =~ /^[A-Z]\w+$/) {
+ push @out, '@_' . $one . '_@';
+ #Log("inserted variable $one");
+ }
+ else {
+ push @out, $one;
+ #Log("inserted set $one");
+ }
}
}
my $page = $Tag->filter('filesafe', $CGI->{ui_page});
@@ -62,7 +64,15 @@
$page .= $Config->{HTMLsuffix}
unless $page =~ /$Config->{HTMLsuffix}$/;
#Log("final page=$page");
- push @out, '';
+ if (@out) {
+ push @out, '';
+ } else {
+ my $content = $CGI->{ui_content};
+ $content =~ s/^(<!-- BEGIN CONTENT -->)+//;
+ $content =~ s/(<!-- END CONTENT -->)+$//;
+ $content =~ s/\r?\n/\n/g;
+ push @out, $content;
+ }
unless ($Tag->write_relative_file($page, (join "\n", @out))) {
$Scratch->{ui_error} = errmsg("Couldn't save page %s.", $page);
}