[interchange-cvs] interchange - heins modified 6 files
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Sun Apr 10 01:25:15 EDT 2005
User: heins
Date: 2005-04-10 05:25:15 GMT
Modified: lib/Vend/Table Editor.pm
Modified: dist/lib/UI/pages/admin db_metaconfig.html
Added: eg/survey_wizard email.tag survey_wizard.coretag
Added: eg/survey_wizard/pages/admin overall.html
Added: eg/survey_wizard/pages/survey standard.html
Log:
* Modify table editor to easily switch between display types without
having (necessarily) to create your own row_template. Defines
eight standard display types, three of which were already in
use -- image_meta (UI), simple_row (unused, probably) and
the default.
* Add admin/db_metaconfig support to select the display type in the
normal flex_editor.
* Add fields_template_only=1 parameter to [table-editor] that allows you
to input a simple table with only the field definitions -- wraps it in
a standard overall_template.
* Create an example [survey-wizard ] tag that uses these new features. It:
-- reads multi-column page descriptions like [table-editor]
-- accepts file uploads
-- allows targeting of file uploads to a directory
-- allows completely custom per-page templates for complex HTML
forms
-- works in conjunction with changed [email ...] tag to attach
file-upload fields to the results email
This is created in eg/ because it will be in flux as it is gradually
adapted to allow multi-faceted content upload for products in a
"wizard" format -- i.e. upload images, PDF documents, license keys,
etc. to multiple tables, directories, and targets with emailed
workflow.
As far as I can tell, the current is completely compatible with
auto-wizard, but that will change over time and it may be renamed
or just kept in eg/ for custom implementation.
* The new [email] tag is as far as known completely compatible with
the current tag, and allows attachments to be added with
parameters, i.e. in the simplest case:
[email
from="Me"
to="You"
subject=Test
attach="foo.pdf"
]
Here is the pdf.
[/email]
Also allows more complicated multiple uploads:
[email
from="Me"
to="You"
subject=Test
attach.1="foo.pdf"
attach.2="bar.pdf"
]
Here are the pdfs.
[/email]
or even:
[email
from="Me"
to="You"
subject=Test
attach.1=`{
path => 'foo.pdf',
filename => "Mike's copy of foo.pdf",
disposition => 'attachment',
type => 'application/pdf',
}`
attach.2=`{
path => 'bar.pdf',
filename => "Jon's copy of foo.pdf",
disposition => 'attachment',
type => 'application/pdf',
}`
]
Here are the pdfs.
[/email]
Revision Changes Path
1.64 +291 -74 interchange/lib/Vend/Table/Editor.pm
rev 1.64, prev_rev 1.63
Index: Editor.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Table/Editor.pm,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- Editor.pm 30 Dec 2004 18:00:23 -0000 1.63
+++ Editor.pm 10 Apr 2005 05:25:14 -0000 1.64
@@ -1,6 +1,6 @@
# Vend::Table::Editor - Swiss-army-knife table editor for Interchange
#
-# $Id: Editor.pm,v 1.63 2004/12/30 18:00:23 mheins Exp $
+# $Id: Editor.pm,v 1.64 2005/04/10 05:25:14 mheins Exp $
#
# Copyright (C) 2002-2003 Interchange Development Group
# Copyright (C) 2002 Mike Heins <mike at perusion.net>
@@ -26,7 +26,7 @@
package Vend::Table::Editor;
use vars qw($VERSION);
-$VERSION = substr(q$Revision: 1.63 $, 10);
+$VERSION = substr(q$Revision: 1.64 $, 10);
use Vend::Util;
use Vend::Interpolate;
@@ -127,6 +127,226 @@
);
my $F_desc = \%Vend::Interpolate::Filter_desc;
+my $Trailer;
+
+use vars qw/%Display_type %Display_options/;
+
+%Display_options = (
+ three_column => sub {
+ my $opt = shift;
+ $opt->{cell_span} = 3;
+ return;
+ },
+ nospace => sub {
+ my $opt = shift;
+ $opt->{break_cell_first_style} ||= 'border-top: 1px solid #999999';
+ return;
+ },
+);
+
+%Display_type = (
+ default => sub {
+ my $opt = shift;
+ my $thing = <<EOF;
+ <td$opt->{label_cell_extra}>
+ {BLABEL}{LABEL}{ELABEL}{META_STRING}
+ </td>
+ <td$opt->{data_cell_extra}\{COLSPAN}>
+ <table cellspacing=0 cellmargin=0 width="100%">
+ <tr>
+ <td$opt->{widget_cell_extra}>
+ {WIDGET}
+ </td>
+ <td$opt->{help_cell_extra}>{TKEY}{HELP?}<i>{HELP}</i>{/HELP?}{HELP_URL?}<BR><A HREF="{HELP_URL}">$opt->{help_anchor}</A>{/HELP_URL?}</td>
+ </tr>
+ </table>
+ </td>
+EOF
+ chomp $thing;
+ return $thing;
+ },
+ blank => sub {
+ my $opt = shift;
+ my $thing = <<EOF;
+EOF
+ chomp $thing;
+ return $thing;
+
+ },
+ nospace => sub {
+ my $opt = shift;
+ my $span = shift;
+ $opt->{break_template} ||= <<EOF;
+<tr$opt->{break_row_extra}><td colspan=$span $opt->{break_cell_extra}\{FIRST?} style="$opt->{break_cell_first_style}"{/FIRST?}>{ROW}</td></tr>
+EOF
+ my $thing = <<EOF;
+ <td$opt->{label_cell_extra}>
+ {BLABEL}{LABEL}{ELABEL}
+ </td>
+ <td$opt->{data_cell_extra}\{COLSPAN}>
+ <table cellspacing=0 cellmargin=0 width="100%">
+ <tr>
+ <td$opt->{widget_cell_extra}>
+ {WIDGET}
+ </td>
+ <td$opt->{help_cell_extra}>{TKEY}{HELP?}<i>{HELP}</i>{/HELP?}{HELP_URL?}<BR><A HREF="{HELP_URL}">$opt->{help_anchor}</A>{/HELP_URL?}</td>
+ <td align=right>{META_STRING}</td>
+ </tr>
+ </table>
+ </td>
+EOF
+ chomp $thing;
+ return $thing;
+
+ },
+ text_js_help => sub {
+ my $opt = shift;
+ my $thing = <<EOF;
+ <td$opt->{label_cell_extra}>
+ {BLABEL}{LABEL}{ELABEL}
+ </td>
+ <td$opt->{data_cell_extra}\{COLSPAN} nowrap>{WIDGET}{HELP_EITHER?} <a href="{HELP_URL?}{HELP_URL}{/HELP_URL?}{HELP_URL:}javascript:alert('{HELP}'); void(0){/HELP_URL:}" title="{HELP}">$opt->{help_anchor}</a>{/HELP_EITHER?} {META_URL?}<A HREF="{META_URL}">$opt->{meta_anchor}</A>{/META_URL?}
+ </td>
+EOF
+ chomp $thing;
+ return $thing;
+ },
+ three_column => sub {
+ my $opt = shift;
+ my $thing = <<EOF;
+ <td$opt->{label_cell_extra}>
+ {BLABEL}{LABEL}{ELABEL}
+ </td>
+ <td$opt->{data_cell_extra}\{COLSPAN} nowrap>
+ {WIDGET}
+ </td>
+ <td>{HELP_EITHER?} <a href="{HELP_URL}" title="{HELP}">$opt->{help_anchor}</a>{/HELP_EITHER?} {META_URL?}<A HREF="{META_URL}">$opt->{meta_anchor}</A>{/META_URL?}
+ </td>
+EOF
+ chomp $thing;
+ return $thing;
+ },
+ simple_row => sub {
+#::logDebug("calling simple_row display");
+ my $opt = shift;
+ my $thing = <<EOF;
+ <td$opt->{label_cell_extra}>
+ {BLABEL}{LABEL}{ELABEL}
+ </td>
+ <td$opt->{data_cell_extra}\{COLSPAN} nowrap>{WIDGET}{HELP_EITHER?} <a href="{HELP_URL}" title="{HELP}">$opt->{help_anchor}</a>{/HELP_EITHER?} {META_URL?}<A HREF="{META_URL}">$opt->{meta_anchor}</A>{/META_URL?}
+ </td>
+EOF
+ chomp $thing;
+ return $thing;
+ },
+ over_under => sub {
+ my $opt = shift;
+ my $thing = <<EOF;
+{HELP?}
+ <td colspan=2$opt->{help_cell_extra}>
+ {HELP}
+ </td>
+</tr>
+<tr>
+{/HELP?} <td colspan=2$opt->{label_cell_extra}>
+ {LABEL}
+ </td>
+</tr>
+<tr>
+ <td colspan=2$opt->{widget_cell_extra}>
+ {WIDGET}
+ </td>
+EOF
+ chomp $thing;
+ return $thing;
+ },
+ image_meta => sub {
+ my $opt = shift;
+ my $span = shift;
+ $opt->{break_template} ||= <<EOF;
+$opt->{spacer_row}
+<tr$opt->{break_row_extra}><td colspan=$span $opt->{break_cell_extra}>{ROW}</td></tr>
+EOF
+ my $thing = <<EOF;
+ <td$opt->{label_cell_extra}>
+ {BLABEL}{LABEL}{ELABEL}
+ </td>
+ <td$opt->{data_cell_extra}\{COLSPAN}>
+ <table cellspacing=0 cellmargin=0 width="100%">
+ <tr>
+ <td$opt->{widget_cell_extra}>
+ {WIDGET}
+ </td>
+ <td$opt->{help_cell_extra}>{TKEY}{HELP?}{HELP}{/HELP?}{HELP_URL?}<BR><A HREF="{HELP_URL}">$opt->{help_anchor}</A>{/HELP_URL?}</td>
+ <td align=right>{META_STRING}</td>
+ </tr>
+ </table>
+ </td>
+EOF
+ chomp $thing;
+ return $thing;
+ },
+ simple_help_below => sub {
+ my $opt = shift;
+ my $thing = <<EOF;
+ <td$opt->{label_cell_extra}>
+ {BLABEL}{LABEL}{ELABEL}
+ </td>
+ <td$opt->{data_cell_extra}\{COLSPAN}>
+ {WIDGET}
+ {HELP_EITHER?}<br$Trailer>{/HELP_EITHER?}
+ {HELP}{HELP_URL?}<br$Trailer><a href="{HELP_URL}">$opt->{help_anchor}</a>{/HELP_URL?}
+ {META_URL?}<A HREF="{META_URL}">$opt->{meta_anchor}</A>{/META_URL?}
+ </td>
+ </tr>
+ </table>
+ </td>
+EOF
+ chomp $thing;
+ return $thing;
+ },
+ simple_icon_help => sub {
+ my $opt = shift;
+ $opt->{help_icon} ||= '/icons/small/unknown.gif';
+ my $thing = <<EOF;
+ <td$opt->{label_cell_extra}>
+ {BLABEL}{LABEL}{ELABEL}
+ </td>
+ <td$opt->{data_cell_extra}\{COLSPAN}>
+ <table width="100%">
+ <tr>
+ <td style="padding-left: 3px">
+ {WIDGET}
+ </td>
+ <td align=right>
+ {HELP_EITHER?} <a href="{HELP_URL?}{HELP_URL}{/HELP_URL?}{HELP_URL:}javascript:alert('{HELP}'); void(0){/HELP_URL:}" title="{HELP}"><img src="$opt->{help_icon}" border=0></a>{/HELP_EITHER?} {META_URL?}<A HREF="{META_URL}">$opt->{meta_anchor}</A>{/META_URL?}
+ </td>
+ </tr>
+ </table>
+ </td>
+EOF
+ chomp $thing;
+ return $thing;
+ },
+);
+
+my %dt_map = qw/
+ simple_row 1
+ text_help 2
+ simple_icon_help 3
+ over_under 4
+ simple_help_below 5
+ image_meta 6
+ three_column 7
+ nospace 8
+/;
+
+for(keys %dt_map) {
+ $Display_type{$dt_map{$_}} = $Display_type{$_}
+ if $Display_type{$_};
+ $Display_options{$dt_map{$_}} = $Display_options{$_}
+ if $Display_options{$_};
+}
my $fdesc_sort = sub {
return 1 if $a and ! $b;
@@ -1051,6 +1271,7 @@
label_cell_class => 'clabel',
data_cell_class => 'cdata',
help_cell_class => 'chelp',
+ break_cell_class_first => 'cbreakfirst',
break_cell_class => 'cbreak',
spacer_row_class => 'rspacer',
break_row_class => 'rbreak',
@@ -1323,6 +1544,7 @@
widget_cell_class
widget_cell_style
widget_class
+ xhtml
/;
if($opt->{cgi}) {
@@ -1617,6 +1839,15 @@
$opt->{ui_data_fields} =~ s/[\s,\0]+$//;
#::logDebug("fields now=$opt->{ui_data_fields}");
+ if(my $dt = $opt->{display_type}) {
+ my $sub = $Display_options{$dt};
+ $sub and ref($sub) eq 'CODE' and $sub->($opt);
+ }
+
+ #### This code is also in main editor routine, change there too!
+ my $cells_per_span = $opt->{cell_span} || 2;
+ ####
+
## Visual field layout
if($opt->{ui_data_fields} =~ /[\w:.]+[ \t,]+\w+.*\n\w+/) {
my $cs = $opt->{colspan} ||= {};
@@ -1634,14 +1865,13 @@
my $cnt = scalar(@$_);
if ($cnt < $max) {
my $name = $_->[-1];
- $cs->{$name} = (($max - $cnt) * 2) + 1;
+ $cs->{$name} = (($max - $cnt) * $cells_per_span) + 1;
}
}
}
#### This code is also in main editor routine, change there too!
my $rowdiv = $opt->{across} || 1;
- my $cells_per_span = $opt->{cell_span} || 2;
my $rowcount = 0;
my $span = $rowdiv * $cells_per_span;
####
@@ -1686,6 +1916,7 @@
my ($table, $key, $opt, $overall_template) = @_;
show_times("begin table editor call item_id=$key") if $Global::ShowTimes;
+#::logDebug("overall_template=$overall_template\nin=$opt->{overall_template}");
use vars qw/$Tag/;
editor_init($opt);
@@ -1780,10 +2011,13 @@
resolve_options($opt, undef, $data);
+ $Trailer = $opt->{xhtml} ? '/' : '';
if($regin) {
## Must reset these in case they get set from all_opts.
$hidden = $opt->{hidden};
}
+ $overall_template = $opt->{overall_template}
+ if $opt->{overall_template};
$table = $opt->{table};
$key = $opt->{item_id};
@@ -1792,6 +2026,7 @@
}
#::logDebug("key after resolve_options: $key");
+#::logDebug("cell_span=$opt->{cell_span}");
#### This code is also in resolve_options routine, change there too!
my $rowdiv = $opt->{across} || 1;
my $cells_per_span = $opt->{cell_span} || 2;
@@ -2205,7 +2440,7 @@
mv_blob_nick=$key$extra
",
});
- $url_data{$key} .= "$key - $lab</A><br>";
+ $url_data{$key} .= "$key - $lab</A><br$Trailer>";
}
else {
$wid_data{$key} = $key;
@@ -2769,7 +3004,7 @@
if($show_meta) {
if(! $opt->{row_template} and ! $opt->{simple_row}) {
- $opt->{meta_prepend} = '<br><font size=1>'
+ $opt->{meta_prepend} = "<br$Trailer><font size=1>"
unless defined $opt->{meta_prepend};
$opt->{meta_append} = '</font>'
@@ -2801,71 +3036,20 @@
#::logDebug("display_type='$opt->{display_type}' row_template length=" . length($row_template));
if(! $row_template) {
- if($opt->{simple_row} || $opt->{display_type} eq 'simple_row') {
- $row_template = <<EOF;
- <td$opt->{label_cell_extra}>
- {BLABEL}{LABEL}{ELABEL}
- </td>
- <td$opt->{data_cell_extra}\{COLSPAN}>{WIDGET}{HELP_EITHER?} <a href="{HELP_URL}" title="{HELP}">$opt->{help_anchor}</a>{/HELP_EITHER?} {META_URL?}<A HREF="{META_URL}">$opt->{meta_anchor}</A>{/META_URL?}
- </td>
-EOF
- }
- elsif($opt->{image_meta}) {
- $opt->{break_template} ||= <<EOF;
-$opt->{spacer_row}
-<tr$opt->{break_row_extra}><td colspan=$span $opt->{break_cell_extra}>{ROW}</td></tr>
-EOF
- $row_template = <<EOF;
- <td$opt->{label_cell_extra}>
- {BLABEL}{LABEL}{ELABEL}
- </td>
- <td$opt->{data_cell_extra}\{COLSPAN}>
- <table cellspacing=0 cellmargin=0 width="100%">
- <tr>
- <td$opt->{widget_cell_extra}>
- {WIDGET}
- </td>
- <td$opt->{help_cell_extra}>{TKEY}{HELP?}{HELP}{/HELP?}{HELP_URL?}<BR><A HREF="{HELP_URL}">$opt->{help_anchor}</A>{/HELP_URL?}</td>
- <td align=right>{META_STRING}</td>
- </tr>
- </table>
- </td>
-EOF
- }
- elsif($opt->{display_type} eq 'over_under') {
- $row_template = <<EOF;
-{HELP?}
- <td colspan=2$opt->{help_cell_extra}>
- {HELP}
- </td>
-</tr>
-<tr>
-{/HELP?} <td colspan=2$opt->{label_cell_extra}>
- {LABEL}
- </td>
-</tr>
-<tr>
- <td colspan=2$opt->{widget_cell_extra}>
- {WIDGET}
- </td>
-EOF
+ $opt->{display_type} = 'simple_row' if $opt->{simple_row};
+ $opt->{display_type} ||= 'image_meta' if $opt->{image_meta};
+ my $dt = $opt->{display_type} ||= 'default';
+
+ $dt =~ s/-/_/g;
+ $dt =~ s/\W+//g;
+#::logDebug("display_type=$dt");
+ my $sub = $Display_type{$dt};
+ if(ref($sub) eq 'CODE') {
+ $row_template = $sub->($opt, $span);
}
else {
- $row_template = <<EOF;
- <td$opt->{label_cell_extra}>
- {BLABEL}{LABEL}{ELABEL}{META_STRING}
- </td>
- <td$opt->{data_cell_extra}\{COLSPAN}>
- <table cellspacing=0 cellmargin=0 width="100%">
- <tr>
- <td$opt->{widget_cell_extra}>
- {WIDGET}
- </td>
- <td$opt->{help_cell_extra}>{TKEY}{HELP?}<i>{HELP}</i>{/HELP?}{HELP_URL?}<BR><A HREF="{HELP_URL}">$opt->{help_anchor}</A>{/HELP_URL?}</td>
- </tr>
- </table>
- </td>
-EOF
+ ::logError("table-editor: display_type '%s' sub not found", $dt);
+ $row_template = $Display_type{default}->($opt, $span);
}
}
@@ -2879,7 +3063,7 @@
EOF
$opt->{break_template} ||= <<EOF;
-<tr$opt->{break_row_extra}><td colspan=$span $opt->{break_cell_extra}>{ROW}</td></tr>
+<tr$opt->{break_row_extra}><td colspan=$span $opt->{break_cell_extra}\{FIRST?} style="$opt->{break_cell_first_style}"{/FIRST?}>{ROW}</td></tr>
EOF
my %serialize;
@@ -3384,7 +3568,7 @@
}
});
$meta_specific = <<EOF;
-<br><a href="$meta_url_specific"$opt->{meta_extra} tabindex=9999>$opt->{meta_anchor_specific}</A>
+<br$Trailer><a href="$meta_url_specific"$opt->{meta_extra} tabindex=9999>$opt->{meta_anchor_specific}</A>
EOF
}
@@ -3830,6 +4014,26 @@
return undef;
};
+ if($opt->{fields_template_only}) {
+ my $tstart = '<table';
+ for my $p (qw/height width cellspacing cellmargin cellpadding class style/) {
+ my $tag = "table_$p";
+ next unless length $opt->{$tag} and $opt->{$tag} =~ /\S/;
+ my $val = HTML::Entities::encode($opt->{$tag});
+ $tstart .= qq{ $p="$val"};
+ }
+ $tstart .= ">";
+ $overall_template = qq({TOP_OF_FORM}
+{HIDDEN_FIELDS}
+$tstart
+<tr><td colspan="$span">{TOP_BUTTONS}</td></tr>
+<tr><td colspan="$span">$overall_template</td></tr>
+<tr><td colspan="$span">{BOTTOM_BUTTONS}</td></tr>
+</table>
+{BOTTOM_OF_FORM}
+);
+ }
+
unless($opt->{incomplete_form_ok}) {
$overall_template =~ /{TOP_OF_FORM}/
or return $death->('TOP_OF_FORM');
@@ -3849,7 +4053,11 @@
}
elsif($name =~ s/__WIDGET$//) {
$thing = delete $outhash{$name};
+ my $lab = "${name}__LABEL";
+ my $help = "${name}__HELP";
#::logDebug("Got to widget replace $name, thing=$thing");
+ $overall_template =~ s/\{$lab\}/$thing->{LABEL}/;
+ $overall_template =~ s/\{$help\}/$thing->{HELP}/;
$overall_template =~ s/\{$orig\}/$thing->{WIDGET}/;
}
elsif($thing) {
@@ -3884,13 +4092,18 @@
push @put, tabbed_display(\@titles,\@tabcont,$opt);
}
else {
+ my $first = 0;
for(my $i = 0; $i < @controls; $i++) {
- push @put, tag_attr_list($opt->{break_template}, { ROW => $titles[$i] })
+ push @put, tag_attr_list(
+ $opt->{break_template},
+ { FIRST => ! $first++, ROW => $titles[$i] },
+ )
if $titles[$i];
push @put, create_rows($opt, $controls[$i]);
}
}
$overall_template =~ s/{:REST}/join "\n", @put/e;
+#::logDebug("overall_template:\n$overall_template");
return $overall_template;
}
@@ -3913,9 +4126,13 @@
}
else {
#::logDebug("titles=" . uneval(\@titles) . "\ncontrols=" . uneval(\@controls));
+ my $first = 0;
for(my $i = 0; $i < @controls; $i++) {
- push @put, tag_attr_list($opt->{break_template}, { ROW => $titles[$i] })
- if $titles[$i];
+ push @put, tag_attr_list(
+ $opt->{break_template},
+ { FIRST => ! $first++, ROW => $titles[$i] },
+ )
+ if $titles[$i];
push @put, create_rows($opt, $controls[$i]);
}
}
2.20 +17 -1 interchange/dist/lib/UI/pages/admin/db_metaconfig.html
rev 2.20, prev_rev 2.19
Index: db_metaconfig.html
===================================================================
RCS file: /var/cvs/interchange/dist/lib/UI/pages/admin/db_metaconfig.html,v
retrieving revision 2.19
retrieving revision 2.20
diff -u -r2.19 -r2.20
--- db_metaconfig.html 11 Feb 2004 19:59:05 -0000 2.19
+++ db_metaconfig.html 10 Apr 2005 05:25:14 -0000 2.20
@@ -94,6 +94,7 @@
extended.top_buttons
extended.view_from
extended.ui_profile
+ extended.display_type
=Form Linking
@@ -151,6 +152,7 @@
'extended.no_checkbox' => "No checkbox for group ops",
'extended.check_uncheck_all' => 'Links to check/uncheck all',
'extended.number_list' => "Number the entries",
+ 'extended.display_type' => "Table cell display type",
'extended.file_upload' => 'Allow file upload for this table',
'extended.filter_field' => 'Import field filtering',
'extended.left_width' => 'Width specification for label column',
@@ -237,6 +239,7 @@
table2:fieldname2=filter1 filter2
</pre>
</blockquote>},
+ 'extended.display_type' => "Sets the general style of column edit areas",
'extended.link_rows_blank' => 'default 1',
'extended.link_row_qual' => 'Default is key field, needs to be different field if auto-numbering. Must not be same as Foreign Key if in auto mode.',
'extended.link_blank_auto' => 'Requires link row qualifier be separate from primary key and foreign key in linked table.',
@@ -265,6 +268,7 @@
'extended.number_list' => 'yesno',
'extended.check_uncheck_all' => 'yesno',
'extended.file_upload' => 'yesno',
+ 'extended.display_type' => 'select',
'extended.filter_field' => 'textarea_2_40',
'extended.tab_style' => 'textarea_5_40',
'extended.panel_style' => 'textarea_5_40',
@@ -366,6 +370,18 @@
'extended.link_before' => '',
'extended.ui_more_decade' => '0=No,5,10*,15,20,25,50,100',
'extended.ui_sort_option' => q{=none,n=numeric,r=reverse,f=case-insensitive},
+ 'extended.display_type' => $Variable->{UI_TABLE_EDITOR_DISPLAY_TYPES}
+ || q{
+ image_meta=Standard UI,
+ default=default,
+ simple_row=Simpler,
+ text_help=Simple with text/js help,
+ simple_icon_help=Simple with icon/js help,
+ over_under=Over and under,
+ simple_help_below=Simple with help below,
+ three_column=Three column,
+ nospace=Like UI but no spacing,
+ },
'extended.ui_special_add' => q{NONE,
Qty price;pricing:q5:rn=Qty price,
Option;products:option_type=Options,
@@ -378,4 +394,4 @@
]
@_UI_STD_FOOTER_@
-<!-- page: @@MV_PAGE@@ version: $Revision: 2.19 $ -->
+<!-- page: @@MV_PAGE@@ version: $Revision: 2.20 $ -->
1.1 interchange/eg/survey_wizard/email.tag
rev 1.1, prev_rev 1.0
Index: email.tag
===================================================================
# Copyright 2002 Interchange Development Group (http://www.icdevgroup.org/)
# Licensed under the GNU GPL v2. See file LICENSE for details.
# $Id: email.tag,v 1.1 2005/04/10 05:25:14 mheins Exp $
UserTag email Order to subject reply from extra
UserTag email hasEndTag
UserTag email addAttr
UserTag email Interpolate
UserTag email Version $Revision: 1.1 $
UserTag email Routine <<EOR
sub {
my ($to, $subject, $reply, $from, $extra, $opt, $body) = @_;
my $ok = 0;
my @extra;
$subject = '<no subject>' unless defined $subject && $subject;
$reply = '' unless defined $reply;
$reply = "Reply-to: $reply\n" if $reply;
if (! $from) {
$from = $Vend::Cfg->{MailOrderTo};
$from =~ s/,.*//;
}
$extra =~ s/\s*$/\n/ if $extra;
$extra .= "From: $from\n" if $from;
@extra = grep /\S/, split(/\n/, $extra);
SEND: {
$ok = send_mail($to, $subject, $body, $reply, 0, @extra);
}
if (!$ok) {
logError("Unable to send mail using $Vend::Cfg->{'SendMailProgram'}\n" .
"To '$to'\n" .
"From '$from'\n" .
"With extra headers '$extra'\n" .
"With reply-to '$reply'\n" .
"With subject '$subject'\n" .
"And body:\n$body");
}
return $opt->{hide} ? '' : $ok;
}
EOR
1.1 interchange/eg/survey_wizard/survey_wizard.coretag
rev 1.1, prev_rev 1.0
Index: survey_wizard.coretag
===================================================================
# Copyright 2002 Interchange Development Group (http://www.icdevgroup.org/)
# Licensed under the GNU GPL v2. See file LICENSE for details.
# $Id: survey_wizard.coretag,v 1.1 2005/04/10 05:25:14 mheins Exp $
UserTag survey-wizard Order name
UserTag survey-wizard AddAttr
UserTag survey-wizard HasEndTag
UserTag survey-wizard Version $Revision: 1.1 $
UserTag survey-wizard Routine <<EOR
use vars qw/$Session $Tag $CGI $Tmp $Scratch $Values $ready_safe/;
my @wanted_opts = qw/
already_message
already_title
attach_fields
bottom_buttons
break_row_class
combo_row_class
data_cell_class
data_row_class
page_template_1
page_template_2
page_template_3
page_template_4
page_template_5
page_template_6
page_template_7
page_template_8
page_template_9
page_template_10
page_template_11
page_template_12
page_template_13
display_type
help_cell_class
intro_text
label_cell_class
left_width
output_type
spacer_row_class
table_width
thanks_message
thanks_title
top_buttons
widget_cell_class
email_from
email_cc
email_subject
email_template
continue_template
row_template
output_email
output_fields
output_repeated
/;
my %overall_opt;
@overall_opt{@wanted_opts} = @wanted_opts;
sub sw_thanks_title {
my ($opt, $already, $default) = @_;
my $tt = $already
? ($opt->{already_title} ||= "You already did that survey!" )
: ($opt->{thanks_title} ||= $default || "Thanks for completing the survey!");
return errmsg($tt);
}
sub sw_thanks_message {
my ($opt, $already) = @_;
my $tm;
if($already) {
$opt->{already_message} ||=
"We only want to collect information once from each person. Thank you.";
$tm = $opt->{already_message};
}
else {
$opt->{thanks_message} ||= "Your survey is complete. Thank you.";
$tm = $opt->{thanks_message};
}
return errmsg($tm);
$opt->{intro_text} .= "<h1>$tm</h1>" if $already;
}
sub sw_title_and_message {
my ($opt, $already) = @_;
my $tt = sw_thanks_title($opt, $already);
my $tm = sw_thanks_message($opt, $already);
return (
'',
"final: $tt",
'template: <<EOF',
$tm,
'EOF',
);
}
sub sw_already {
my ($wizname, $set) = @_;
my $surv = $Vend::Session->{surveys} ||= {};
if(defined $set) {
$surv->{$wizname} = $set;
}
if ($Vend::Session->{logged_in} and ! $Vend::admin) {
if (! defined $surv->{$wizname}) {
my $o = {
function => 'check_file_acl',
location => "survey/$wizname",
};
$surv->{$wizname} = $Tag->userdb($o);
}
else {
my $o = {
function => 'set_file_acl',
location => "survey/$wizname",
mode => $surv->{$wizname},
};
$Tag->userdb($o);
}
}
return $surv->{$wizname};
}
sub sw_survey_log_generate_final {
my ($wizname, $opt, $ary) = @_;
ref($opt) eq 'HASH'
or die "bad call to generate_final routine, output options not hash ref ($opt)";
ref($ary) eq 'ARRAY'
or die "bad call to generate_final routine, output not array ref ($ary)";
my $done = sw_already($wizname);
push @$ary, sw_title_and_message($opt, $done);
if ( $done ) {
$opt->{intro_text} .= '<h1>' . sw_thanks_title($opt, 1) . '</h1>';
}
# else {
# $opt->{survey_counter} ||= "logs/survey/$wizname.cnt";
# $opt->{survey_file} ||= "logs/survey/$wizname.txt";
# push @$ary, "\tsurvey_file: $opt->{survey_file}";
# push @$ary, "\tsurvey_counter: $opt->{survey_counter}";
# }
return;
}
sub sw_find_attachments {
my ($ref, $opt) = @_;
my @fields = @$ref;
my @attachments;
if($opt->{file_upload} and $opt->{attach_fields}) {
@attachments = grep /\S/, split /[\s,\0]/, $opt->{attach_fields};
my %att;
@att{@attachments} = @attachments;
@$ref = grep ! $att{$_}, @$ref;
@fields = grep ! $att{$_}, @fields;
}
return wantarray ? @attachments : \@attachments;
}
sub sw_non_attachments {
my ($ref, $opt) = @_;
my @fields = @$ref;
my @attachments;
if($opt->{file_upload} and $opt->{attach_fields}) {
@attachments = grep /\S/, split /[\s,\0]/, $opt->{attach_fields};
my %att;
@att{@attachments} = @attachments;
@fields = grep ! $att{$_}, @fields;
}
return wantarray ? @fields : \@fields;
}
sub sw_gen_email_template {
my ($wizname, $ref, $opt, $fnames) = @_;
my $tpl = <<EOF;
{code?}Sequence: {code}
{/code?}Username: {username}
IP Address: $CGI::remote_addr
Host: $CGI::remote_host
Date: {date}
--------------------------------------------
EOF
my @fields = grep /\S/, split /\s+/, $opt->{output_fields};
if(! @fields) {
@fields = @$fnames;
}
@fields = sw_non_attachments(\@fields, $opt);
for(@fields) {
$tpl .= "$_: {$_}\n";
}
$tpl .= "--------------------------------------------\n";
return $tpl;
}
sub sw_email_output {
my ($wizname, $ref, $opt, $fnames) = @_;
#::logDebug("Called sw_email_output");
return unless $opt->{output_email};
#::logDebug("sw_email_output has an address of $opt->{output_email}");
## Check and see if already sent
if(! $opt->{output_repeated} and sw_already($wizname)) {
#::logDebug("sw_email_output already done, repeated=$opt->{output_repeated} already=" . ::uneval($Vend::Session->{surveys}));
return;
}
#::logDebug("sw_email_output is continuing");
my $tpl = $opt->{email_template};
if(! $tpl or $tpl !~ /\S/) {
$tpl = sw_gen_email_template($wizname, $ref, $opt, $fnames);
}
else {
$opt->{email_template} =~ s/\s+$//;
$opt->{email_template} =~ s/^\s+//;
if($opt->{email_template} !~ /[\r\n]/) {
$tpl = interpolate_html(Vend::Util::readfile($opt->{email_template}));
}
else {
$tpl = $opt->{email_template};
}
}
my $subject = errmsg($opt->{email_subject} || "Response to %s", $wizname);
my $from_addr = $opt->{email_from};
my $cc_addr = $opt->{email_cc};
if(! $from_addr) {
for(qw/ EMAIL_SURVEY EMAIL_INFO EMAIL_SERVICE /) {
next unless $from_addr = $::Variable->{$_};
last;
}
}
$from_addr ||= $Vend::Cfg->{MailOrderFrom} || $Vend::Cfg->{MailOrderTo};
#::logDebug("sw_email_output tpl=$tpl");
my @fields = grep /\S/, split /\s+/, $opt->{output_fields};
if(! @fields) {
@fields = @$fnames;
}
my @attachments = sw_find_attachments(\@fields, $opt);
#::logDebug("Found (in=$opt->{attach_fields}) attachments: " . join(",", @attachments));
my $outref = { %$opt };
$outref->{ip_address} = $CGI::remote_addr;
$outref->{host_name} = $CGI::remote_host;
$outref->{username} = $Vend::username || 'anonymous';
$outref->{date} = POSIX::strftime("%Y-%m-%d %H:%M:%S", localtime());
my $attach;
my $ul = $::Scratch->{user_uploads};
for my $afield (@attachments) {
next unless $ul->{$afield};
$attach ||= [];
my %a = (
path => $ul->{$afield},
);
if($Vend::Session->{logged_in}) {
my $dn = $::Variable->{SURVEY_LOG_DIR} || 'logs/survey';
$dn .= "/user_upload/$Vend::username";
$dn = Vend::Util::escape_chars($dn);
File::Path::mkpath($dn) unless -e $dn;
File::Copy::copy($ul->{$afield}, $dn);
}
push @$attach, \%a;
}
for(@fields) {
$outref->{$_} = $Values->{$_};
}
my $out = tag_attr_list($tpl, $outref);
my %email = (
from => $from_addr,
to => $opt->{output_email},
subject => $subject,
cc => $cc_addr,
attach => $attach,
);
my $status;
$status = $Tag->email(\%email, $out)
or ::logError("Failed to send survey email output:\n$out");
#::logDebug("sw_email_output status=$status");
return $status;
}
sub sw_survey_log_to_file {
my ($wizname, $ref, $opt, $fnames) = @_;
if(! $opt->{output_repeated} and sw_already($wizname)) {
return sw_template_attr($wizname, $ref, $opt, $fnames);
}
my $fn = $ref->{survey_file};
my $cfn = $ref->{survey_counter};
my $sqlc = $ref->{survey_counter_sql};
if(! $fn) {
$fn = $::Variable->{SURVEY_LOG_DIR} || 'logs/survey';
$fn .= "/$wizname.txt";
}
if(! $cfn and ! $sqlc) {
$cfn = $fn;
$cfn =~ s/\.txt$//;
$cfn .= '.cnt';
$cfn =~ s:(.*/):$1.:;
}
my @fields = grep /\S/, split /\s+/, $opt->{output_fields};
if(! @fields) {
@fields = @$fnames;
}
if(! -f $fn) {
my $string = join "\t",
'code', 'ip_address', 'username', 'date', @fields;
$string .= "\n";
$Tag->write_relative_file($fn, $string);
}
my @o = $Tag->counter({file => $cfn, sql => $sqlc});
push @o, $CGI::remote_addr;
push @o, $Vend::username || 'anonymous';
push @o, POSIX::strftime("%Y-%m-%d %H:%M:%S", localtime());
for(@fields) {
my $result = $Values->{$_};
$result =~ s/\r?\n/\r/g;
$result =~ s/\t/ /g;
push @o, $result;
}
::logData($fn, @o);
sw_email_output($wizname, $ref, $opt, $fnames);
sw_already($wizname => 1) unless $opt->{output_repeated};
return sw_template_attr($wizname, $ref, $opt, $fnames);
}
my %survey_genfinal = (
survey_log => \&sw_survey_log_generate_final,
email_only => sub {
my ($wizname, $opt, $ary) = @_;
push @$ary, sw_title_and_message($opt, sw_already($wizname));
if($opt->{continue_template}) {
push @$ary, "template: <<EOF";
push @$ary, $opt->{continue_template};
push @$ary, 'EOF';
}
return;
},
default => sub {
my ($wizname, $opt, $ary) = @_;
my $line = "final: ";
$line .= sw_thanks_title(
$opt,
$Vend::Session->{surveys}{$wizname},
errmsg("Finished with %s", $wizname),
);
push @$ary, '';
push @$ary, $line;
if($opt->{continue_template}) {
push @$ary, "template: <<EOF";
push @$ary, $opt->{continue_template};
push @$ary, 'EOF';
}
return;
},
);
sub sw_template_attr {
my ($wizname, $ref, $opt, $fields) = @_;
my %attr;
if(ref($fields) eq 'hash') {
%attr = { %$fields };
}
$attr{TITLE} = $ref->{_page_title} || "Finished with $wizname...";
$attr{PROMPT} = $ref->{prompt};
$attr{ANCHOR} = $ref->{anchor} || 'Go';
$attr{EXTRA} = $ref->{extra} || '';
$attr{EXTRA} = " $attr{EXTRA}" if $attr{EXTRA};
$attr{URL} = sw_wizard_url($ref, $opt, $fields);
#::logDebug("generated ATTR is: " . uneval(\%attr));
my $template = $ref->{template} || <<EOF;
<H1>{TITLE}</h1>
{PROMPT}
<p>
<blockquote>
<A HREF="{URL}"{EXTRA}>{ANCHOR}</A>
</blockquote>
EOF
return tag_attr_list($template, \%attr);
}
sub sw_wizard_url {
my ($ref, $opt, $fields) = @_;
my %attr;
my %ignore = qw/
page
href
template
remap
/;
my $form = { };
for(keys %$ref) {
next if /^_/;
next if $ignore{$_};
$form->{$_} = $ref->{$_};
}
$form->{href} = $opt->{output_href} || $ref->{href} || $ref->{page};
if($opt->{output_parm}) {
my $ref = Vend::Util::scalar_to_hash($opt->{output_parm}) || {};
for (keys %$ref) {
$form->{$_} = $ref->{$_};
}
}
$form->{form} = 'auto';
for(@$fields) {
$form->{$_} = $Values->{$_};
}
my $save = { };
if($ref->{remap}) {
my @pairs = split /[\s,\0]+/, $ref->{remap};
for(@pairs) {
my ($k, $v) = split /=/, $_;
next unless $k and $v;
my $val = delete($form->{$k}) || $save->{$k};
$save->{$k} = $val;
$form->{$v} = $val;
}
}
return $Tag->area($form);
}
my %survey_auto = qw/
survey_log 1
email_only 1
auto_bounce 1
/;
## Called with:
##
## $$dest = $sub->($wizname, $ref, $opt, \@vals);
##
## $wizname name of wizard/survey
## $ref copy of final stanza of auto_wizard, hash ref with keys, can modify
## %opts Options auto_wizard was created with, can modify
## @vals Fields names collected in the wizard, can modify
my %survey_action = (
survey_log => \&sw_survey_log_to_file,
auto_bounce => sub {
my ($wizname, $ref, $opt, $fnames) = @_;
my $url = sw_wizard_url($ref, $opt, $fnames);
email_output($wizname, $ref, $opt, $fnames);
my $status = $Tag->deliver( { type => 'text/html', location => $url });
return $status;
},
default => sub {
my ($wizname, $ref, $opt, $fnames) = @_;
$ref->{wizard_name} = $wizname;
sw_email_output($wizname, $ref, $opt, $fnames);
return sw_template_attr($wizname, $ref, $opt, $fnames);
},
);
sub sw_compile_wizard {
my ($wizname, $opt, $script) = @_;
#Debug("script in: $script");
$script =~ s/^\s+//;
$script =~ s/\r\n/\n/g;
$script =~ s/\r/\n/g;
my @lines = split /\n/, $script;
my $ref;
my @pages;
my $qip; # question in progress
my $iip; # item in progress
my $fip; # final in progress
my $bip; # breaks in progress
my $blip; # break labels in progress
my $began; # We have begun
my $sip;
my $vip;
my $mark;
my $break;
my %opts;
if($opt->{db_id}) {
#Debug("found db_id=$opt->{db_id}");
my ($t, $k) = split /:+/, $opt->{db_id}, 2;
BUILDWIZ: {
my $met = $Tag->meta_record($k, undef, $t)
or last BUILDWIZ;
my($structure) = delete $met->{ui_data_fields};
delete $met->{extended};
%opts = %$met;
#Debug("display type=$opts{display_type} met=" . ::uneval($met) );
$met->{row_template} = $opt->{row_template}
if $opt->{row_template};
my $ids = $t . '::' . $k . '::';
$structure =~ s/\r\n?/\n/g;
my $string = "\n\n$structure";
my %break;
while ($string =~ s/\n+(?:\n[ \t]*=(.*))?\n+[ \t]*(\w[:.\w]+)/\n$2/) {
$break{$2} = $1;
}
$string =~ s/^[\s,\0]+//;
$string =~ s/[\s,\0]+$//;
my @pic = grep /\S/, split /[\r\n]+/, $string;
#Debug("pic=" . ::uneval(\@pic) );
$string =~ s/[,\0\s]+/ /g;
my @fields = split /\s+/, $string;
my @out = "$k: $met->{label}";
my $i = 1;
for my $sf (@fields) {
if($break{$sf}) {
my @flines;
push @out, "$i: $break{$sf}";
my $start = 0;
for my $nf (@pic) {
my @f = split /[,\0\s]+/, $nf;
if($start) {
if($break{$f[0]}) {
last;
}
else {
push @flines, $nf;
}
}
elsif($sf eq $f[0]) {
$start = 1;
push @flines, $nf;
}
}
push @out, "layout: " . join "|", @flines;
#Debug("layout: " . join "|", @flines);
$i++;
}
push @out, "\tdb_id: $ids$sf";
push @out, '';
}
$opts{output_fields} ||= join " ", @fields;
my $otype = $opts{output_type} || 'default';
my $sub = $survey_genfinal{$otype} || $survey_genfinal{default};
$sub->($k, \%opts, \@out);
@lines = @out;
}
}
#Debug("Found some lines, number=" . scalar @lines);
#Debug("display type=$opts{display_type}");
for(@lines) {
if($mark) {
$sip .= "$_\n", next
unless $_ eq $mark;
$_ = $sip;
undef $mark;
undef $sip;
}
if (s/<<(\w+)$//) {
$mark = $1;
$sip = $_;
next;
}
s/\s+$//;
if(! $_) {
undef $iip;
next;
}
if(! $ref) {
if(/^(\w+):\s*(.*)/) {
$began = 1;
$wizname ||= $1;
my $title = $2;
$ref = {
_page_name => 'begin',
_name => [],
title => $title,
%opts,
};
}
next;
}
if(/^(\d+)[:.]\s*(.*)/) {
my $pn = $1; my $title = $2;
push @pages, $ref;
my $lastpage = $ref->{_page_name};
$qip = [];
undef $bip;
undef $blip;
$ref = {
_page_name => $pn,
_name => $qip,
_breaks => $bip,
_break_labels => $blip,
_page_title => $title,
};
next;
}
if(/^layout:\s*(.*)/) {
my @lines = split /\|/, $1;
$ref->{wizard_layout} = join "\n", @lines;
next;
}
if(/^final[:.]\s*(.*)/) {
undef $qip;
undef $iip;
$fip = 1;
my $title = $1;
push @pages, $ref;
my $lastpage = $ref->{_page_name};
$ref = { _page_name => 'final', _page_title => $title};
next;
}
if($fip) {
s/^\s+//;
unless (/^([A-Za-z]\w+)(?:=([^:]+))?\s*:\s*(.*)/s) {
$Tag->warnings(qq{Unrecognized "$_" in middle of script.});
next;
}
my $thing = $1;
my $modifier = $2;
my $value = $3;
if($modifier) {
$ref->{_modifier} ||= {};
$ref->{_modifier}{$thing} = $modifier;
}
$ref->{$thing} = $value;
next;
}
if($qip) {
if(/^(itl|perl)(?:_condition)?:\s*(.*)$/s) {
if(! $ref->{_condition}) {
$ref->{_condition_type} = $1;
$ref->{_condition} = $2;
}
else {
$Tag->error(
"%s_condition: cannot set twice in wizard %s screen %s",
$1,
$pages[0]->{_title},
$ref->{_page_name},
);
return;
}
next;
}
elsif(/^opt:\s*(.*)$/s) {
my $option = $1;
$option =~ s/\s+$//;
my ($n, $v) = split /=/, $option, 2;
my $o = $ref->{_options} ||= [];
push @$o, $n, $v;
next;
}
s/^\s+//;
unless (/^([A-Za-z]\w+)(?:=([^:]+))?\s*:\s*(.*)/s) {
$Tag->warnings(qq{Unrecognized "$_" in middle of script.});
next;
}
my $thing = $1;
my $modifier = $2;
my $value = $3;
if(! $iip) {
## This redoes the loop
if($thing eq 'name') {
$thing = $value;
undef $value;
}
elsif($thing eq 'break') {
$break = $value;
$break =~ s/,/)/g;
$ref->{_breaks} ||= ($bip = []);
$ref->{_break_labels} ||= ($blip = []);
next;
}
elsif($thing eq 'db_id') {
my ($t, $survey, $name) = split /:+/, $value, 3;
$thing = $name;
my $key = $survey . '::' . $name;
my $meta = $Tag->meta_record($key, undef, $t);
if($meta) {
for(keys %$meta) {
$ref->{$_} ||= {};
$ref->{$_}{$thing} = $meta->{$_};
}
}
$ref->{name}{$thing} = $thing;
#::logDebug("meta record is " . ::uneval($meta));
undef $value;
}
$iip = $thing;
push @$qip, $iip;
if($break) {
push @$bip, $iip;
push @$blip, "$iip=$break";
undef $break;
}
$ref->{label}{$iip} = $value if $value;
next;
}
if($modifier) {
$ref->{_modifier} ||= {};
$ref->{_modifier}{$thing} ||= {};
$ref->{_modifier}{$thing}{$iip} = $modifier;
}
$ref->{$thing} ||= {};
$ref->{$thing}{$iip} = $value;
}
else {
unless (/^([A-Za-z]\w+)(?:=([^:]+))?\s*:\s*(.*)/s) {
$Tag->warnings(qq{Unrecognized "$_" in beginning section of script.});
next;
}
my $thing = $1;
my $modifier = $2;
my $value = $3;
$ref->{$thing} = $value;
}
}
push @pages, $ref;
$wizname ||= 'default';
my $wiz_ary = $Session->{auto_wizard} ||= {};
$wiz_ary->{$wizname} = \@pages;
#Debug("Wizard $wizname=" . ::uneval(\@pages));
return $wizname;
}
sub {
my ($wizname, $opt, $body) = @_;
my $dest;
$wizname ||= $CGI->{wizard_name};
if($opt->{scratch}) {
$Tag->tmp($opt->{scratch});
$::Scratch->{$opt->{scratch}} ||= '';
$dest = \$::Scratch->{$opt->{scratch}};
}
else {
$Tmp->{auto_wizard} ||= '';
$dest = \$Tmp->{auto_wizard};
}
return $$dest if $opt->{show} and ! $opt->{run};
if($opt->{compile} eq 'auto') {
$Session->{auto_wizard} ||= {};
undef $opt->{compile} if $wizname && $Session->{auto_wizard}{$wizname};
$opt->{show} = 1 unless defined $opt->{show};
$opt->{run} = 1;
}
if($opt->{compile}) {
my $n;
$n = sw_compile_wizard(@_)
or do {
::logError(
$$dest = errmsg(
"Wizard %s failed to compile.",
$wizname,
)
);
return;
};
#Debug("compiler returned wizname=$n");
$wizname = $n;
undef $body;
}
if(! defined $opt->{run}) {
$opt->{run} = 1;
$opt->{show} = 0 if ! defined $opt->{show};
}
my $title_var = $opt->{title_scratch} || 'page_title';
my $banner_var = $opt->{banner_scratch} || 'page_banner';
my $wiz;
$wizname ||= $CGI->{wizard_name} || 'default';
#Debug("wizname=$wizname");
return unless $wiz = $Vend::Session->{auto_wizard}{$wizname};
#Debug("we have a wiz! wizname=$wizname");
my $beg = $wiz->[0];
my $fin = $wiz->[-1];
for($beg, $fin) {
return "Bad wizard!" unless ref($_) eq 'HASH';
}
my $lastwiz = $#$wiz;
my $lastpage = $CGI->{wizard_page} || 0;
my $current_page;
my %opts;
copyref($beg, \%opts);
# Get rid of internal stuff
for(keys %opts) {
next unless /^_/;
delete $opts{$_};
}
if($CGI->{ui_wizard_action} eq 'Back') {
$current_page = $lastpage - 1;
}
elsif($CGI->{ui_wizard_action} eq 'Cancel') {
$current_page = 0;
}
elsif($CGI->{ui_wizard_action} eq 'Next') {
$current_page = $lastpage + 1;
}
else {
$current_page = $lastpage;
}
my $finished;
my $condition_done;
my $optref;
#::logDebug("Getting screens");
GETSCREEN: {
$optref = $wiz->[$current_page];
if(! $condition_done and $optref->{_condition}) {
$condition_done = 1;
my $result;
if($optref->{_condition_type} eq 'itl') {
eval {
$result = interpolate_html($optref->{_condition});
};
$result =~ s/\s+$//;
$result =~ s/.*\s//s;
$result += 0;
$current_page += $result;
}
else {
eval {
$result = $ready_safe->reval($optref->{_condition});
};
if($@) {
$Tag->error(
"error during perl conditional: $@\ncode was:\n%s",
$@,
$optref->{_condition},
);
$current_page -= 1;
}
$result += 0;
#::logDebug("did perl conditional, result=$result");
$current_page += $result;
}
redo GETSCREEN;
}
if($current_page <= 0) {
$current_page = 1;
}
elsif ( ($current_page + 1) == $lastwiz ) {
$opts{next_text} = errmsg('Finish')
if $survey_auto{$opts{output_type}} or $fin->{auto};
}
elsif ($current_page >= $lastwiz) {
$finished = 1;
}
$optref = $wiz->[$current_page];
}
unless($current_page <= 1) {
delete $opts{intro_text};
delete $optref->{intro_text};
}
my %modsub = (
i => sub {
my $val = shift;
# ::logDebug("running interpolate of $val");
return interpolate_html($val);
},
default => sub {
my $val = shift;
my $filters = join " ", @_;
return $Tag->filter($filters, $val);
},
);
$Scratch->{$title_var} = $optref->{_page_title};
$Scratch->{$banner_var} = $optref->{_page_title};
if($finished) {
my $ref = { %$fin };
my $mod;
if( $mod = delete $ref->{_modifier}) {
for(keys %$ref) {
next if /^_/;
if(my $m = $mod->{$_}) {
my $v = $ref->{$_};
my $sub = $modsub{$m} || $modsub{default};
$ref->{$_} = $sub->($ref->{$_}, $m);
}
}
}
my @vals;
for my $w (@$wiz) {
next unless ref($w->{_name}) eq 'ARRAY';
push @vals, @{$w->{_name}};
}
my $otype = $opts{output_type};
$otype ||= 'auto_bounce' if $ref->{auto};
my $sub = $survey_action{$otype} || $survey_action{default};
$$dest = $sub->($wizname, $ref, \%opts, \@vals);
return $$dest if $opt->{show};
return;
#Debug("finished, page ref=" . uneval($ref));
}
#Debug("we have a wiz=$wizname! current_page = $current_page");
#Debug("optref=" . $Tag->uneval(undef, $optref));
#::logDebug("prepping to walk optref");
### TODO: Find bad reference when no section title...
my $name = $optref->{_name} || die;
# $Scratch->{page_title} = $optref->{_page_title};
if($optref->{_breaks} and ref($optref->{_breaks}) eq 'ARRAY') {
$opts{ui_break_before} = join " ", @{$optref->{_breaks}};
$opts{ui_break_before_label} = join ",", @{$optref->{_break_labels}};
}
if(my $o = $optref->{_options}) {
for (my $i = 0; $i < @$o; $i += 2) {
$opts{$o->[$i]} = $o->[$i + 1];
}
}
$opts{form_name} ||= 'wizard';
$opts{all_errors} = '1';
$opts{hidden} = {
wizard_name => $wizname,
wizard_page => $current_page,
};
$opts{wizard} = 1;
$opts{notable} = 1;
$opts{no_meta} = 1;
$opts{defaults} = 1;
$opts{mv_cancelpage} ||= 'index';
$opts{row_template} ||= $opt->{row_template} || <<'EOF' unless $opts{display_type};
{HELP?}<td> </td><td>
<span style="color: blue">{HELP}</span>
{HELP_URL?}<BR><A HREF="{HELP_URL}">more help</A>{/HELP_URL?}
</td>
</tr>
<tr class=rnorm>
{/HELP?}
<td class=cdata width="20%" valign=top>
{LABEL}
</td>
<td class=cdata width=500>
$WIDGET$
</td>
</tr>
<tr class=rspacer>
<td colspan=2><img src="bg.gif" height=1 width=1></td>
EOF
if($optref->{wizard_layout} =~ / /) {
$opts{ui_wizard_fields} = $optref->{wizard_layout};
$opts{display_type} = $opts{multi_display_type} || '3';
}
else {
$opts{ui_wizard_fields} = join " ", @$name;
}
$opts{mv_nextpage} = $Global::Variable->{MV_PAGE};
$opts{mv_prevpage} = $Global::Variable->{MV_PAGE} if $current_page != 1;
$opts{bottom_buttons} = 1;
#::logDebug("walking optref");
my $mod = $optref->{_modifier} || '';
for(keys %$optref) {
next if /^_/;
next if $overall_opt{$_};
next unless ref($optref->{$_}) eq 'HASH';
$opts{$_} = {} if ref($opts{$_}) ne 'HASH';
Vend::Util::copyref($optref->{$_}, $opts{$_});
my $m;
if($mod and $m = $mod->{$_}) {
my $r = $opts{$_};
for my $k (keys %$r) {
next unless $m->{$k};
my @subs = split /\s*,\s*/, $m->{$k};
for(@subs) {
my $sub = $modsub{$_} || $modsub{default};
$r->{$k} = $sub->($r->{$k}, $_);
}
}
}
}
if(my $tpl = $opts{"page_template_$current_page"}) {
#::logDebug("yup, found a template=$tpl");
$opts{row_template} = '';
$opts{display_type} = 'default';
$opts{fields_template_only} = 1;
$opts{overall_template} = $tpl;
}
$opts{widget} ||= {};
if( my $r = delete $opts{type} ) {
for(keys %$r) {
$opts{widget}{$_} = $r->{$_};
}
}
delete $opts{type};
# Prevent ui_data_fields from parent corrupting wizard
delete $opts{ui_data_fields};
delete $opts{extended};
#::logDebug("calling table_editor opts=" . ::uneval(\%opts));
$$dest = $Tag->table_editor( {all_opts => \%opts });
if($$dest !~ /<form\s+/i) {
my $msg = errmsg("Auto wizard failed to run wizard %s.", $name);
$$dest .= $Tag->error({ show => 1, set => $msg });
}
return $$dest if $opt->{show};
return;
}
EOR
1.1 interchange/eg/survey_wizard/pages/admin/overall.html
rev 1.1, prev_rev 1.0
Index: overall.html
===================================================================
[set table_perms]survey[/set]
[if !cgi item_id]
[cgi name=item_id set="[cgi code]" hide=1]
[/if]
[cgi name=mv_data_table set=survey hide=1]
[tmp page_title]
Edit survey: [cgi item_id]
[/tmp]
[set ui_class]Admin[/set]
[calc]
#make absolutely sure
my $id = $CGI->{item_id};
$id = lc $id;
$id =~ s/\W+/_/g;
$CGI->{item_id} = $id;
return;
[/calc]
[if cgi survey_clone]
[flag type=write table=survey]
[perl tables=survey]
my $id = $CGI->{item_id};
$id = lc $id;
$id =~ s/\W+/_/g;
my $cid = $CGI->{survey_clone};
my $db = $Db{survey};
if($db->record_exists($id)) {
$Tag->error( {
name => 'survey_clone',
set => errmsg("will not clone over existing survey %s", $id),
});
return;
}
$db->clone_row($cid, $id);
my $ary = $db->query("select code from survey where code like '$cid:%'");
for(@$ary) {
my $old = $_->[0];
my $new = $old;
$new =~ s/^ $cid : /$id:/x
or do {
$Tag->warnings("Cannot clone row $old to $new");
next;
};
$db->clone_row($old, $new);
}
return;
[/perl]
[/if]
[set click_delete_survey]
[flag type=write table=survey]
[perl tables=survey]
my $id = $CGI->{item_id};
my $db = $Db{survey};
$db->delete_record($id);
my $ary = $db->query("select code from survey where code like '$id:%'");
for(@$ary) {
$db->delete_record($_->[0]);
}
$Tag->warnings(errmsg("Survey %s and all its questions deleted.", $id));
return;
[/perl]
mv_nextpage=admin/survey/index
[/set]
@_UI_STD_HEAD_@
[if cgi zero_out]
[calc] delete $Session->{surveys}; delete $Session->{auto_wizard}; return; [/calc]
[/if]
<blockquote>
[if !value formatter]
[page href=@@MV_PAGE@@
form=|
item_id=[cgi item_id]
mv_action=return
formatter=1
|]Use option formatter</A>
[tmpn options_extra]
ui_te_widget:options=textarea_12_80
ui_te_filter:options=line2options
ui_te_pre_filter:options=options2line
ui_te_help:options=One option per line, value to left of = sign.
ui_te_default:options==--select one--
[/tmpn]
[else]
[page href=@@MV_PAGE@@
form=|
item_id=[cgi item_id]
mv_action=return
formatter=0
|]Use freeform option type</A>
[tmpn options_extra]
ui_te_widget:options=option_format
ui_te_filter:options=option_format
ui_te_help:options=Value on left, label on right.
ui_te_default:options==--select one--
[/tmpn]
[/else]
[/if]
[page href=@@MV_PAGE@@ form="
item_id=[cgi item_id]
zero_out=1
"]Zero "already completed"</A>
<div style="font-size: larger">
Access URL:
[area no_session_id=1 no_count=1 href=survey/standard form="survey_start=[cgi item_id]"]
([page no_session_id=1 no_count=1 href=survey/standard form="survey_start=[cgi item_id]"]run</A>)
</div>
</blockquote>
[if type=data term="survey::code::[cgi item_id]"]
[tmpn survey_hide_key]1[/tmpn]
[tmp list_questions][data table=survey col=extended.ui_data_fields key="[cgi item_id]" serial=1][/tmp]
[calc]
my $string = $Scratch->{list_questions} or return;
#::logDebug("fields were=$opt->{ui_data_fields}");
my $ids = $CGI->{item_id} . '::';
$string =~ s/\r\n/\n/g;
$string =~ s/\r/\n/g;
$string =~ s/^[ \t]+//mg;
$string =~ s/[ \t]+$//mg;
my %break;
if($string =~ /\n\n/) {
my @breaks;
my @break_labels;
my $fstring = "\n\n$string";
while ($fstring =~ s/\n+(?:\n[ \t]*=(.*))?\n+[ \t]*(\w[:.\w]+)/\n$2/) {
$break{$2} = $1;
}
$breaks = join(" ", @breaks);
$breaks = join(",", @break_labels);
$string = $fstring;
}
$string =~ s/^[\s,\0]+//;
$string =~ s/[\s,\0]+$//;
$string =~ s/[,\0\s]+/ /g;
my @fields = split /\s+/, $string;
my @out = "code\tname\tlabel";
for(@fields) {
push @out, join "\t", "$ids$_", $_, $break{$_} || '';
}
$Scratch->{list_questions} = join "\n", @out;
return;
[/calc]
[/if]
[calc]
# init for use below
$survey_page_number = 1;
return;
[/calc]
<table>
<tr>
[loop lr=1 head-skip=1 list="[scratch list_questions]"]
[on-match]
<td valign=top>
<table>
<tr class=rmarq>
<td>
Question field
</td>
<td>
Question
</td>
</tr>
[/on-match]
[list]
[if-loop-param label]
<tr class=rbreak>
<td colspan=2 style="border: 1px solid #996633;">
[loop-param label]
[page href="__UI_BASE__/flex_editor"
form="
mv_data_table=survey
item_id=[cgi item_id]
ui_data_fields=code extended.page_template_[calc]$survey_page_number[/calc]
no_table_meta=1
ui_te_widget:extended.page_template_[calc]$survey_page_number[/calc]=textarea_40_80
ui_te_label:extended.page_template_[calc]$survey_page_number[/calc]=Custom page template
ui_return_to=@@MV_PAGE@@
tabbed=0
ui_return_to=item_id=[cgi item_id]
"]custom page</A>
[calc] $survey_page_number++; return; [/calc]
</td>
</tr>
[/if-loop-param]
<tr class="[item-alternate 2]rnorm[else]ralt[/else][/item-alternate]">
<td>
[page href="__UI_BASE__/flex_editor"
form="
mv_data_table=survey
item_id=[loop-code]
ui_te_override:name=[loop-param name]
[scratch options_extra]
ui_return_to=@@MV_PAGE@@
ui_return_to=item_id=[cgi item_id]
"][loop-param name]</A>
</td>
<td>
[if-loop-data survey label]
[loop-filter 30.][loop-data survey label][/loop-filter]
[else]
(not yet input)
[/else]
[/if-loop-data]
</td>
<td>
[page href=survey/graph arg="[loop-code]"]results</A>
</td>
</tr>
[/list]
[on-match]
</table>
<blockquote>
<a href="[area href=@@MV_PAGE@@
form="
mv_click=click_delete_survey
item_id=[cgi item_id]
mv_action=back
"
]"
onClick="confirm('Are you sure you want to delete [cgi item_id] and all its questions?')"
><img src="delete.gif" border=0> Delete survey [cgi item_id]</A>
</blockquote>
[/on-match]
</td>
[/loop]
<td>
[table-editor
table=survey
no-table-meta=1
tabbed=1
table_width=620
tab_width=100
output-map="[scratch ui_style_edit]"
ui_style="[scratch ui_style_edit]"
break_row_class=rmarq
panel_width=600
panel_height=500
no-meta=1
left_width=130
label_cell_valign=top
help_cell_width=150
start_at="[cgi start_at]"
item_id="[cgi item_id]"
ui_hide_key="[scratch survey_hide_key]"
ui_data_fields="
=General
code
label
type
extended.display_type
extended.intro_text
extended.file_upload
extended.attach_fields
=Questions
extended.ui_data_fields
=Display page
extended.bottom_buttons
extended.top_buttons
extended.table_width
extended.left_width
=HTML Classes
extended.data_row_class
extended.break_row_class
extended.title_row_class
extended.spacer_row_class
extended.combo_row_class
extended.border_cell_class
extended.label_cell_class
extended.data_cell_class
extended.widget_cell_class
extended.help_cell_class
=Survey Output
extended.output_type
extended.output_href
extended.output_parm
extended.output_email
extended.email_template
extended.email_from
extended.email_cc
extended.output_repeated
=Thanks
extended.thanks_title
extended.thanks_message
extended.already_title
extended.already_message
"
label=`{
code => 'Survey key',
label => 'Main title',
'extended.already_message' => 'Message to show when already completed',
'extended.already_title' => 'Title when already completed',
'extended.attach_fields' => 'Fields to attach',
'extended.border_cell_class' => 'Border cell class',
'extended.bottom_buttons' => 'Buttons only on bottom',
'extended.break_row_class' => 'Break row class',
'extended.combo_row_class' => 'User widget row class',
'extended.data_cell_class' => 'Data cell class (standard row)',
'extended.data_row_class' => 'Data row class',
'extended.display_type' => 'Display type',
'extended.email_cc' => 'Who to Cc: on email response',
'extended.email_from' => 'Address emailed response is from',
'extended.email_template' => 'Email template or file',
'extended.file_upload' => 'Allow file upload',
'extended.help_cell_class' => 'Help cell class (standard row)',
'extended.intro_text' => 'Intro Text',
'extended.label_cell_class' => 'Label cell class (standard row)',
'extended.left_width' => 'Width specification for label column',
'extended.other_fields' => 'Other information to collect',
'extended.output_email' => 'Target email address',
'extended.output_href' => 'Forward-to page or URL',
'extended.output_parm' => 'Forward-to extra parameters',
'extended.output_repeated' => 'Allow repeated survey?',
'extended.output_type' => 'Output Type',
'extended.restrict_allow' => 'Allow these ITL tags',
'extended.title_row_class' => 'Title row class',
'extended.spacer_row_class' => 'Spacer row class',
'extended.table_width' => 'Width specification for editor table',
'extended.thanks_message' => 'Body of finished page',
'extended.thanks_title' => 'Title for finished page',
'extended.top_buttons' => 'Buttons only on top',
'extended.ui_data_fields' => 'Question fields',
'extended.ui_display_only' => 'Fields for display only',
'extended.widget_cell_class' => 'Widget cell class (standard row)',
}`
help=`{
'extended.output_email' => 'Address for sending email fulfillment.',
'extended.email_template' => 'Template for email fulfillment. Looks for a file if one line, uses default template if empty.',
'extended.output_href' => 'Page base for forwarded URL, will have form paramters added. Use http:// only if outside IC catalog.',
'extended.output_parm' => 'Extra parameters for forwarded url, key=value, one per line.',
'extended.output_repeated' => 'Set to yes to allow more than one response per session or per user',
'extended.intro_text' => 'Introduction to survey (if any). Shown on first page only.',
'extended.ui_data_fields' => 'Page divisions can be embedded in the fields by placing "=Title String" on a line by itself and surrounding with blank lines.',
'extended.ui_display_only' => 'Will not be set, only shown.',
}`
widget=`{
code => 'text_20',
label => 'text_60',
type => 'hidden',
'extended.already_message' => 'textarea_4_60',
'extended.already_title' => 'text_60',
'extended.attach_fields' => 'text_60',
'extended.bottom_buttons' => 'yesno',
'extended.display_type' => 'select',
'extended.email_cc' => 'text_40',
'extended.email_from' => 'text_40',
'extended.email_template' => 'textarea_4_60',
'extended.file_upload' => 'yesno',
'extended.intro_text' => 'textarea_8_50',
'extended.left_width' => 'text_8',
'extended.output_email' => 'text_40',
'extended.output_href' => 'text_40',
'extended.output_parm' => 'textarea_2_40',
'extended.output_repeated' => 'yesno',
'extended.output_type' => 'select',
'extended.panel_height' => 'text_5',
'extended.panel_width' => 'text_5',
'extended.table_width' => 'text_8',
'extended.thanks_message' => 'textarea_4_60',
'extended.thanks_title' => 'text_60',
'extended.top_buttons' => 'yesno',
'extended.ui_data_fields' => 'textarea_20_60',
'extended.view_from' => 'select',
}`
override.type=master
filter=`{
height => 'digits',
}`
database=`{
'extended.ui_sort_field' => $CGI->{ui_table},
'extended.ui_show_fields' => $CGI->{ui_table},
'extended.ui_data_fields' => $CGI->{ui_table},
'extended.view_from' => $CGI->{ui_table},
'extended.spread_fields' => $CGI->{ui_table},
'extended.spread_meta' => $CGI->{ui_table},
'extended.spread_textarea' => $CGI->{ui_table},
}`
height=`{
'extended.ui_sort_field' => 8,
'extended.ui_show_fields' => 8,
'extended.ui_data_fields' => 16,
'extended.spread_fields' => 8,
}`
width=`{
'extended.ui_data_fields' => 30,
'extended.ui_show_fields' => 30,
}`
form=`{
fieldmeta => '',
}`
wid_href=`{
fieldmeta => 'meta_editor',
}`
options=`{
'extended.display_type' => q{
over_under=Question on one line, answer on line below,
0=Question in left column and answer in right column,
},
'extended.output_type' => q{
survey_log=Standard survey log,
email_only=Email response,
auto_bounce=Automatic bounce to page (requires page below),
0=none (use wizard default -- need page below),
},
}`
]
</td>
</tr>
<tr>
<td colspan=2>
Access URL:
[area no_session_id=1 no_count=1 href=survey/standard form="survey_start=[cgi item_id]"]
</td>
</tr>
</table>
@_UI_STD_FOOTER_@
<!-- page: @@MV_PAGE@@ version: $Revision: 1.1 $ -->
1.1 interchange/eg/survey_wizard/pages/survey/standard.html
rev 1.1, prev_rev 1.0
Index: standard.html
===================================================================
[comment]
ui_template: Yes
ui_template_name: noleft
[/comment]
[control reset=1]
[control-set]
[component]search_box_small[/component]
[/control-set]
[control-set]
[component]product_tree[/component]
[/control-set]
[control-set]
[component][/component]
[/control-set]
[control-set]
[component][/component]
[/control-set]
[control-set]
[component]promo[/component]
[matches]3[/matches]
[cols]3[/cols]
[banner][L]Specials[/L][/banner]
[/control-set]
[control reset=1]
<style type="text/css">
.rborder {
background-color: #CCCCCC;
margin: 0;;
padding: 2
}
.rhead {
background-color: #E6E6E6;;
color: #000000;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px
}
A.rhead:active,A.rhead:hover {
color: #000000;
font-size: 12px;
text-decoration: underline;
}
A.rhead:link,A.rhead:visited {
color: #000000;
font-size: 12px;
text-decoration:none;
}
.rheadBold {
background-color: #E6E6E6;
color: #000000;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;;
padding: 4px
}
.rheader {
background-color: #999999;
color: #663333;
}
.rmarq {
background-color: #999999;;
color: #FFFFFF;
font-size: 12px;
font-weight: bold
}
A.rmarq:active,A.rmarq:link,A.rmarq:visited {
color: #FFFFCC;
font-size: 12px;
font-weight: bold;
text-decoration:none;
}
A.rmarq:hover {
color: #FFFF99;
font-size: 12px;
font-weight: bold;
text-decoration: underline;
}
.rnobg {
color: #000000;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
padding: 4px;
}
.rnorm {
background-color: #FFFFFF;
border: 1px solid #CCCCCC;
}
.rowalt {
background-color: #EAF1FB;
color: #000000;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
padding: 4px;
}
A.rowalt:hover,A.rowalt:hover,A.rownorm:active,A.rownorm:hover {
color: #333333;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
text-decoration: underline;
}
A.rowalt:link,A.rowalt:visited,A.rownorm:link,A.rownorm:visited {
color: #333333;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
text-decoration:none;
}
.rownorm {
background-color: #FFFFFF;
color: #000000;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
padding: 4px;
}
.rownormbold {
background-color: #FFFFFF;
color: #000000;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;;
padding: 4px
}
.rseparator {
background-color: #CCCCCC;
}
.rshade {
background-color: #E6E6E6;
color: #000000;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
padding: 4px;
}
.rspacer {
background-color: #999999;
margin: 0;;
padding: 0
}
.rsubbold {
background-color: #FFFFFF;
color: #808080;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;;
padding: 4px
}
.rtitle {
background-color: #808080;;
color: #FFFFFF;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold
}
A.rtitle:active,A.rtitle:link,A.rtitle:visited {
color: #FFFFCC;
font-size: 12px;
font-weight: bold;
text-decoration:none;
}
.s1,.s2 {
color: #666666;;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px
}
.s3 {
color: #333333;;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px
}
.s4 {
color: #666666;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
width: 100%;
}
.rbreak {
background-color: #FFFFFF;
}
.cborder {
background-color: #999999;
padding: 0;
}
.cbreak {
background-color: #EEEEEE;
border-left: 1px solid #999999;
font-size: 11px;;
font-weight: bold
}
.cdata {
border-bottom: 1px solid #CCCCCC;
border-right: 1px solid #CCCCCC;
border-top: 1px solid #CCCCCC;
font-size: 11px;;
margin-right: 4px;
padding-right: 2px;
vertical-align: top
}
.cerror {
color: red;
font-size: 11px;
}
.cheader {
color: #663333;
font-size: 11px;;
font-weight: bold
}
.chelp,.rhint {
color: #AFABA5;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
padding: 4px;
}
.clabel {
border-bottom: 1px solid #CCCCCC;
border-left: 1px solid #CCCCCC;
border-top: 1px solid #CCCCCC;
font-size: 11px;
vertical-align: top;
font-weight: medium;
padding-left: 5px;;
text-align: left
}
.cmiddle {
border-bottom: 1px solid #CCCCCC;
border-top: 1px solid #CCCCCC;
font-size: 11px;
font-weight: medium;
padding-left: 5px;;
text-align: middle
}
.cmessage {
color: green;
font-size: 11px;
}
A:link.ctitle,A:visited.ctitle {
color: white;
font-size: 11px;;
font-weight: bold;
text-decoration: none
}
A:hover.ctitle,A:active.ctitle {
color: yellow;
font-size: 11px;;
font-weight: bold;
text-decoration: underline
}
.ctitle {
font-size: 11px;;
font-weight: bold
}
.cwidget {
font-size: 11px;;
vertical-align: center
}
</style>
[if cgi survey_start]
[calc]
delete $Session->{auto_wizard}{$CGI->{survey_start}};
return;
[/calc]
[tmp survey_id]survey::[cgi survey_start][/tmp]
[/if]
[survey-wizard
compile=auto
show=0
scratch=survey_output
interpolate=1
db_id="[scratch survey_id]"
/]
@_LEFTONLY_TOP_@
<!-- BEGIN CONTENT -->
<blockquote style="color: red">
[warnings]
</blockquote>
<div style="text-align: left; padding: 5">
<h1>[scratch page_title]</h1>
[scratch survey_output]
</div>
[if session admin]
[tmp survey_name][/tmp]
[calc]
my $si = $CGI->{survey_start} || $CGI->{wizard_name};
$si =~ s/.*://;
$Scratch->{survey_name} = $si;
return;
[/calc]
[page href=admin/survey/overall form="item_id=[scratch survey_name]"]Edit survey in admin</a>
[/if]
<!-- END CONTENT -->
@_LEFTONLY_BOTTOM_@
More information about the interchange-cvs
mailing list