Merge branch 'master' into survey
* master: (36 commits) Add a mutator for questionsAnswered, with tests. Fix i18n file namespace. Flesh out the recordResponses POD. Almost ready for more in depth testing. recordResponse tests (just a few) goto tests. Add POD stubs, fully document goto. Fix my stupid typo in the Shelf template with div. nextQuestions tests. Add section separator comments between the subroutines. Remove old discussion related items from the Article templates. matrix compare screen bugfix matrix bug fixes Add more AdminBar tests. Add tests for nextSectionid, nextSection, currentSection. Tests for createSurveyOrder and shuffle. Change ResponseJSON to use a proper mutator for startTime. Forward porting site starter css fix for clears and page content positioning. forward porting quotes in asset title fixTitle test forward port syndicated articles i18n template fix Forward port templated ITransact edit credentials screen. ...
This commit is contained in:
commit
7a42b4b241
49 changed files with 1659 additions and 280 deletions
|
|
@ -226,11 +226,78 @@ sub getEditForm {
|
|||
my $session = $self->session;
|
||||
my $db = $session->db;
|
||||
my $matrixId = $self->getParent->getId;
|
||||
my $tabform = $self->next::method();
|
||||
my $i18n = WebGUI::International->new($session, 'Asset_MatrixListing');
|
||||
my $func = $session->form->process("func");
|
||||
|
||||
my $form = WebGUI::HTMLForm->new($session);
|
||||
|
||||
if ($func eq "add" || ( $func eq "editSave" && $session->form->process("assetId") eq "new")) {
|
||||
$form->hidden(
|
||||
-name =>'assetId',
|
||||
-value =>'new',
|
||||
);
|
||||
$form->hidden(
|
||||
-name =>'class',
|
||||
-value =>'WebGUI::Asset::MatrixListing',
|
||||
);
|
||||
}
|
||||
$form->hidden(
|
||||
-name =>'func',
|
||||
-value =>'editSave',
|
||||
);
|
||||
$form->text(
|
||||
-name =>'title',
|
||||
-defaultValue =>'Untitled',
|
||||
-label =>$i18n->get("product name label"),
|
||||
-hoverHelp =>$i18n->get('product name description'),
|
||||
-value =>$self->getValue('title'),
|
||||
);
|
||||
$form->image(
|
||||
-name =>'screenshots',
|
||||
-defaultValue =>undef,
|
||||
-maxAttachments =>20,
|
||||
-label =>$i18n->get("screenshots label"),
|
||||
-hoverHelp =>$i18n->get("screenshots description"),,
|
||||
-value =>$self->getValue('screenshots'),
|
||||
);
|
||||
$form->HTMLArea(
|
||||
-name =>'description',
|
||||
-defaultValue =>undef,
|
||||
-label =>$i18n->get("description label"),
|
||||
-hoverHelp =>$i18n->get("description description"),
|
||||
-value =>$self->getValue('description'),
|
||||
);
|
||||
$form->text(
|
||||
-name =>'version',
|
||||
-defaultValue =>undef,
|
||||
-label =>$i18n->get("version label"),
|
||||
-hoverHelp =>$i18n->get("version description"),
|
||||
-value =>$self->getValue('version'),
|
||||
);
|
||||
$form->text(
|
||||
-name =>'manufacturerName',
|
||||
-defaultValue =>undef,
|
||||
-label =>$i18n->get("manufacturerName label"),
|
||||
-hoverHelp =>$i18n->get("manufacturerName description"),
|
||||
-value =>$self->getValue('manufacturerName'),
|
||||
);
|
||||
$form->url(
|
||||
-name =>'manufacturerURL',
|
||||
-defaultValue =>undef,
|
||||
-label =>$i18n->get("manufacturerURL label"),
|
||||
-hoverHelp =>$i18n->get("manufacturerURL description"),
|
||||
-value =>$self->getValue('manufacturerURL'),
|
||||
);
|
||||
$form->url(
|
||||
-name =>'productURL',
|
||||
-defaultValue =>undef,
|
||||
-label =>$i18n->get("productURL label"),
|
||||
-hoverHelp =>$i18n->get("productURL description"),
|
||||
-value =>$self->getValue('productURL'),
|
||||
);
|
||||
|
||||
foreach my $category (keys %{$self->getParent->getCategories}) {
|
||||
$tabform->getTab('properties')->raw('<tr><td colspan="2"><b>'.$category.'</b></td></tr>');
|
||||
$form->raw('<tr><td colspan="2"><b>'.$category.'</b></td></tr>');
|
||||
my $attributes;
|
||||
if ($session->form->process('func') eq 'add'){
|
||||
$attributes = $db->read("select * from Matrix_attribute where category = ? and assetId = ?",
|
||||
|
|
@ -246,10 +313,13 @@ sub getEditForm {
|
|||
$attribute->{label} = $attribute->{name};
|
||||
$attribute->{subtext} = $attribute->{description};
|
||||
$attribute->{name} = 'attribute_'.$attribute->{attributeId};
|
||||
$tabform->getTab("properties")->dynamicField(%{$attribute});
|
||||
$form->dynamicField(%{$attribute});
|
||||
}
|
||||
}
|
||||
return $tabform;
|
||||
|
||||
$form->submit();
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -777,7 +847,12 @@ sub www_edit {
|
|||
my $i18n = WebGUI::International->new($self->session, "Asset_MatrixListing");
|
||||
return $self->session->privilege->insufficient() unless $self->canEdit;
|
||||
return $self->session->privilege->locked() unless $self->canEditIfLocked;
|
||||
return $self->getAdminConsole->render($self->getEditForm->print,$i18n->get('edit matrix listing title'));
|
||||
|
||||
my $var = $self->get;
|
||||
my $matrix = $self->getParent;
|
||||
$var->{form} = $self->getEditForm->print;
|
||||
|
||||
return $matrix->processStyle($self->processTemplate($var,$matrix->get("editListingTemplateId")));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -812,6 +887,7 @@ sub www_getAttributes {
|
|||
$attribute->{label} = $attribute->{name};
|
||||
$attribute->{attributeId} =~ s/-/_____/g;
|
||||
if ($attribute->{fieldType} eq 'MatrixCompare'){
|
||||
$attribute->{compareColor} = $self->getParent->getCompareColor($attribute->{value});
|
||||
$attribute->{value} = WebGUI::Form::MatrixCompare->new($self->session,$attribute)->getValueAsHtml;
|
||||
}
|
||||
if($session->scratch->get('stickied_'.$attribute->{attributeId})){
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ use base 'WebGUI::Asset';
|
|||
use WebGUI::International;
|
||||
use WebGUI::Asset::Template::HTMLTemplate;
|
||||
use WebGUI::Utility;
|
||||
use Clone qw/clone/;
|
||||
|
||||
|
||||
=head1 NAME
|
||||
|
|
@ -401,6 +402,30 @@ sub processRaw {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 update
|
||||
|
||||
Override update from Asset.pm to handle backwards compatibility with the old
|
||||
packages that contain headBlocks.
|
||||
|
||||
This method is deprecated and will be removed in the future. Don't plan
|
||||
on this being here.
|
||||
|
||||
=cut
|
||||
|
||||
sub update {
|
||||
my $self = shift;
|
||||
my $requestedProperties = shift;
|
||||
my $properties = clone($requestedProperties);
|
||||
if (exists $properties->{headBlock}) {
|
||||
$properties->{extraHeadTags} .= $properties->{headBlock};
|
||||
delete $properties->{headBlock};
|
||||
}
|
||||
$self->SUPER::update($properties);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_edit {
|
||||
my $self = shift;
|
||||
|
|
|
|||
|
|
@ -1877,13 +1877,15 @@ sub www_ical {
|
|||
# Summary (the title)
|
||||
# Wrapped at 75 columns
|
||||
$ical .= $self->wrapIcal("SUMMARY:".$event->get("title"))."\r\n";
|
||||
|
||||
|
||||
# Description (the text)
|
||||
# Wrapped at 75 columns
|
||||
$ical .= $self->wrapIcal("DESCRIPTION:".$event->get("description"))."\r\n";
|
||||
|
||||
|
||||
|
||||
|
||||
# Location (the text)
|
||||
# Wrapped at 75 columns
|
||||
$ical .= $self->wrapIcal("LOCATION:".$event->get("location"))."\r\n";
|
||||
|
||||
# X-WEBGUI lines
|
||||
if ($event->get("groupIdView")) {
|
||||
$ical .= "X-WEBGUI-GROUPIDVIEW:".$event->get("groupIdView")."\r\n";
|
||||
|
|
@ -1893,11 +1895,11 @@ sub www_ical {
|
|||
}
|
||||
$ical .= "X-WEBGUI-URL:".$event->get("url")."\r\n";
|
||||
$ical .= "X-WEBGUI-MENUTITLE:".$event->get("menuTitle")."\r\n";
|
||||
|
||||
|
||||
$ical .= qq{END:VEVENT\r\n};
|
||||
}
|
||||
# ENDVEVENT
|
||||
|
||||
|
||||
$ical .= qq{END:VCALENDAR\r\n};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -86,6 +86,14 @@ sub definition {
|
|||
hoverHelp =>$i18n->get('compare template description'),
|
||||
label =>$i18n->get('compare template label'),
|
||||
},
|
||||
editListingTemplateId=>{
|
||||
defaultValue =>"matrixtmpl000000000004",
|
||||
fieldType =>"template",
|
||||
tab =>"display",
|
||||
namespace =>"Matrix/EditListing",
|
||||
hoverHelp =>$i18n->get('edit listing template description'),
|
||||
label =>$i18n->get('edit listing template label'),
|
||||
},
|
||||
defaultSort=>{
|
||||
fieldType =>"selectBox",
|
||||
tab =>"display",
|
||||
|
|
@ -326,7 +334,7 @@ sub getCompareColor {
|
|||
elsif($value == 3){
|
||||
return $self->get('compareColorFreeAddOn');
|
||||
}
|
||||
elsif($value == 3){
|
||||
elsif($value == 4){
|
||||
return $self->get('compareColorYes');
|
||||
}
|
||||
|
||||
|
|
@ -656,6 +664,10 @@ sub www_compare {
|
|||
'text/javascript'});
|
||||
$self->session->style->setLink($self->session->url->extras('yui/build/datatable/assets/skins/sam/datatable.css'),
|
||||
{type =>'text/css', rel=>'stylesheet'});
|
||||
$self->session->style->setScript($self->session->url->extras('hoverhelp.js'), {type =>
|
||||
'text/javascript'});
|
||||
$self->session->style->setLink($self->session->url->extras('hoverhelp.css'),
|
||||
{type =>'text/css', rel=>'stylesheet'});
|
||||
|
||||
my $maxComparisons;
|
||||
if($self->session->user->isVisitor){
|
||||
|
|
@ -673,7 +685,7 @@ sub www_compare {
|
|||
|
||||
$var->{javascript} = "<script type='text/javascript'>\n".
|
||||
'var listingIds = new Array('.join(", ",map {'"'.$_.'"'} @listingIds).");\n".
|
||||
'var responseFields = new Array("attributeId", "name", "fieldType", "checked", '.join(", ",map {'"'.$_.'"'} @responseFields).");\n".
|
||||
'var responseFields = new Array("attributeId", "name", "description","fieldType", "checked", '.join(", ",map {'"'.$_.'"'} @responseFields).");\n".
|
||||
"var maxComparisons = ".$maxComparisons.";\n".
|
||||
"var matrixUrl = '".$self->getUrl."';\n".
|
||||
"</script>";
|
||||
|
|
@ -906,11 +918,9 @@ sub www_getCompareFormData {
|
|||
my $form = $session->form;
|
||||
my $sort = shift || $session->scratch->get('matrixSort') || $self->get('defaultSort');
|
||||
my $sortDirection = ' desc';
|
||||
=cut
|
||||
if ( WebGUI::Utility::isIn($sort, qw(revisionDate score)) ) {
|
||||
$sortDirection = " desc";
|
||||
}
|
||||
=cut
|
||||
# if ( WebGUI::Utility::isIn($sort, qw(revisionDate score)) ) {
|
||||
# $sortDirection = " desc";
|
||||
# }
|
||||
my @results;
|
||||
my @listingIds = $self->session->form->checkList("listingId");
|
||||
|
||||
|
|
@ -1024,7 +1034,8 @@ sub www_getCompareListData {
|
|||
$listing->incrementCounter("compares");
|
||||
my $listingId_safe = $listingId;
|
||||
$listingId_safe =~ s/-/_____/g;
|
||||
push(@columnDefs,{key=>$listingId_safe,label=>$listing->get('title'),formatter=>"formatColors"});
|
||||
push(@columnDefs,{key=>$listingId_safe,label=>$listing->get('title'),formatter=>"formatColors",
|
||||
url=>$listing->getUrl});
|
||||
}
|
||||
|
||||
my $jsonOutput;
|
||||
|
|
@ -1032,7 +1043,7 @@ sub www_getCompareListData {
|
|||
|
||||
foreach my $category (keys %{$self->getCategories}) {
|
||||
push(@results,{name=>$category,fieldType=>'category'});
|
||||
my $fields = " a.name, a.fieldType, a.attributeId ";
|
||||
my $fields = " a.name, a.fieldType, a.attributeId, a.description ";
|
||||
my $from = "from Matrix_attribute a";
|
||||
my $tableCount = "b";
|
||||
foreach my $listingId (@listingIds) {
|
||||
|
|
@ -1049,7 +1060,12 @@ sub www_getCompareListData {
|
|||
) });
|
||||
}
|
||||
foreach my $result (@results){
|
||||
unless($result->{fieldType} eq 'category'){
|
||||
if($result->{fieldType} eq 'category'){
|
||||
foreach my $columnDef (@columnDefs) {
|
||||
$result->{$columnDef->{key}} = $columnDef->{label};
|
||||
}
|
||||
}
|
||||
else{
|
||||
foreach my $listingId (@listingIds) {
|
||||
$result->{attributeId} =~ s/-/_____/g;
|
||||
my $listingId_safe = $listingId;
|
||||
|
|
|
|||
|
|
@ -820,7 +820,7 @@ sub prepareShowSurveyTemplate {
|
|||
$section->{'totalQuestions'} = @{$self->response->surveyOrder};
|
||||
$section->{'showProgress'} = $self->get('showProgress');
|
||||
$section->{'showTimeLimit'} = $self->get('showTimeLimit');
|
||||
$section->{'minutesLeft'} = int((($self->response->{startTime} + (60 * $self->get('timeLimit'))) - time())/60);
|
||||
$section->{'minutesLeft'} = int((($self->response->startTime() + (60 * $self->get('timeLimit'))) - time())/60);
|
||||
|
||||
my $out = $self->processTemplate( $section, $self->get("surveyQuestionsId") );
|
||||
|
||||
|
|
@ -953,7 +953,6 @@ sub getResponseId {
|
|||
$self->loadBothJSON($responseId);
|
||||
$self->response->createSurveyOrder();
|
||||
$self->{responseId} = $responseId;
|
||||
$self->response->{startTime} = $time;
|
||||
$self->saveResponseJSON();
|
||||
|
||||
} ## end if ( $haveTaken < $allowedTakes)
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ use strict;
|
|||
use JSON;
|
||||
use Data::Dumper;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 new ( $json, $log, $survey )
|
||||
|
||||
Object constructor.
|
||||
|
|
@ -63,13 +65,12 @@ sub new {
|
|||
my $self = defined $temp ? $temp : {};
|
||||
$self->{survey} = $survey;
|
||||
$self->{log} = $log;
|
||||
$self->{surveyOrder}
|
||||
= defined $temp->{surveyOrder}
|
||||
? $temp->{surveyOrder}
|
||||
: []; #an array of question addresses, with the third member being an array of answers
|
||||
$self->{responses} = defined $temp->{responses} ? $temp->{responses} : {};
|
||||
$self->{lastResponse} = defined $temp->{lastResponse} ? $temp->{lastResponse} : -1;
|
||||
$self->{responses} = defined $temp->{responses} ? $temp->{responses} : {};
|
||||
$self->{lastResponse} = defined $temp->{lastResponse} ? $temp->{lastResponse} : -1;
|
||||
$self->{questionsAnswered} = defined $temp->{questionsAnswered} ? $temp->{questionsAnswered} : 0;
|
||||
$self->{startTime} = defined $temp->{startTime} ? $temp->{startTime} : time();
|
||||
#an array of question addresses, with the third member being an array of answers
|
||||
$self->{surveyOrder} = defined $temp->{surveyOrder} ? $temp->{surveyOrder} : [];
|
||||
bless( $self, $class );
|
||||
return $self;
|
||||
} ## end sub new
|
||||
|
|
@ -122,6 +123,14 @@ sub createSurveyOrder {
|
|||
$self->{surveyOrder} = $order;
|
||||
} ## end sub createSurveyOrder
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 shuffle ( @array )
|
||||
|
||||
Returns the contents of @array in a random order.
|
||||
|
||||
=cut
|
||||
|
||||
sub shuffle {
|
||||
my @a = splice @_;
|
||||
for my $i ( 0 .. $#a ) {
|
||||
|
|
@ -131,6 +140,14 @@ sub shuffle {
|
|||
return @a;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 freeze
|
||||
|
||||
Serializes the object to JSON, after deleting the log and survey objects stored in it.
|
||||
|
||||
=cut
|
||||
|
||||
sub freeze {
|
||||
my $self = shift;
|
||||
my %temp = %{$self};
|
||||
|
|
@ -139,16 +156,43 @@ sub freeze {
|
|||
return to_json( \%temp );
|
||||
}
|
||||
|
||||
#Hash the survey timed out?
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
#Has the survey timed out?
|
||||
|
||||
=head2 hasTimedOut ( $limit )
|
||||
|
||||
Checks to see whether this survey has timed out, based on the internally stored starting
|
||||
time, and $limit.
|
||||
|
||||
=head3 $limit
|
||||
|
||||
How long the user has to take the survey, in minutes.
|
||||
|
||||
=cut
|
||||
|
||||
sub hasTimedOut{
|
||||
my $self=shift;
|
||||
my $limit = shift;
|
||||
return 1 if($self->{startTime} + ($limit * 60) < time() and $limit > 0);
|
||||
return 1 if($self->startTime() + ($limit * 60) < time() and $limit > 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
#the index of the last surveyOrder entry shown
|
||||
|
||||
=head2 lastResponse ([ $responseIndex ])
|
||||
|
||||
Mutator for the index of the last surveyOrder entry shown. With no arguments,
|
||||
returns the lastResponse index.
|
||||
|
||||
=head3 $responseIndex
|
||||
|
||||
If defined, sets the lastResponse to $responseIndex.
|
||||
|
||||
=cut
|
||||
|
||||
sub lastResponse {
|
||||
my $self = shift;
|
||||
my $res = shift;
|
||||
|
|
@ -160,27 +204,177 @@ sub lastResponse {
|
|||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 questionsAnswered ([ $questionsAnswered ])
|
||||
|
||||
Mutator for the number of questions answered. With no arguments,
|
||||
does a set.
|
||||
|
||||
=head3 $questionsAnswered.
|
||||
|
||||
If defined, increments the number of questions by $questionsAnswered
|
||||
|
||||
=cut
|
||||
|
||||
sub questionsAnswered {
|
||||
my $self = shift;
|
||||
my $answered = shift;
|
||||
if ( defined $answered ) {
|
||||
$self->{questionsAnswered} += $answered;
|
||||
}
|
||||
else {
|
||||
return $self->{questionsAnswered};
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 startTime ([ $newStartTime ])
|
||||
|
||||
Mutator for the time the user began the survey. With no arguments,
|
||||
returns the startTime.
|
||||
|
||||
=head3 $newStarttime
|
||||
|
||||
If defined, sets the starting time to $newStartTime.
|
||||
|
||||
=cut
|
||||
|
||||
sub startTime {
|
||||
my $self = shift;
|
||||
my $newTime = shift;
|
||||
if ( defined $newTime ) {
|
||||
$self->{startTime} = $newTime;
|
||||
}
|
||||
else {
|
||||
return $self->{startTime};
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
#array of addresses in which the survey should be presented
|
||||
|
||||
=head2 surveyOrder
|
||||
|
||||
Accessor for the survey order data structure. It is a deep set of arrays, similar in
|
||||
structure to a WebGUI::Asset::Wobject::Survey::SurveyJSON address.
|
||||
|
||||
[ $sectionIndex, $questionIndex, [ $answerIndex1, $answerIndex2, ....]
|
||||
|
||||
There is one array element for every section and address in the survey.
|
||||
|
||||
If there are no questions, or no addresses, those array elements will not be present.
|
||||
|
||||
=cut
|
||||
|
||||
sub surveyOrder {
|
||||
my $self = shift;
|
||||
return $self->{surveyOrder};
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 nextSectionId
|
||||
|
||||
Relative to the surveyOrder and the lastResponse index, get the index of the
|
||||
next section. Note, based on the number of questions in an section, this can
|
||||
be the same as the current section index.
|
||||
|
||||
=cut
|
||||
|
||||
sub nextSectionId {
|
||||
my $self = shift;
|
||||
return undef if $self->surveyEnd();
|
||||
return $self->surveyOrder->[ $self->lastResponse + 1 ]->[0];
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 nextSection
|
||||
|
||||
Relative to the surveyOrder and the lastResponse index, gets the next section.
|
||||
Note, based on the number of questions in a section, this can be the same as
|
||||
the current section.
|
||||
|
||||
=cut
|
||||
|
||||
sub nextSection {
|
||||
my $self = shift;
|
||||
return {} if $self->surveyEnd();
|
||||
return $self->survey->section( [ $self->surveyOrder->[ $self->lastResponse + 1 ]->[0] ] );
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 currentSection
|
||||
|
||||
Relative to the surveyOrder and the lastResponse index, get the current section.
|
||||
|
||||
=cut
|
||||
|
||||
sub currentSection {
|
||||
my $self = shift;
|
||||
return $self->survey->section( [ $self->surveyOrder->[ $self->lastResponse ]->[0] ] );
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 recordResponses ($session, $responses)
|
||||
|
||||
Takes survey responses and puts them into the response hash of this object. Does terminal
|
||||
handling for sections and questions, and goto processing. Advances the survey page if
|
||||
all required questions have been answered.
|
||||
|
||||
=head3 $session
|
||||
|
||||
A WebGUI session object
|
||||
|
||||
=head3 $responses
|
||||
|
||||
A hash ref of form param data. Each element will look like:
|
||||
|
||||
{
|
||||
"__qid__comment" => "question comment",
|
||||
"__aid__" => "answer",
|
||||
"__aid__comment" => "answer comment",
|
||||
}
|
||||
|
||||
where __qid__ is a question id, as described in L<nextQuestions>, and __aid__ is an
|
||||
answer id, also described there.
|
||||
|
||||
=head3 terminal processing
|
||||
|
||||
Terminal processing for a section and its questions and answers are handled in
|
||||
order. The terminalUrl setting in a question overrides the terminalUrl setting
|
||||
for its section. Similarly, with questions and answers, the last terminalUrl
|
||||
setting of the set of questions is what is returned for the page, with the questions
|
||||
and answers being answered in surveyOrder.
|
||||
|
||||
=head3 goto processing
|
||||
|
||||
gotos are handled similarly as with terminalUrls. The last goto in the set of questions
|
||||
wins.
|
||||
|
||||
=head3 responses data structure
|
||||
|
||||
This method also builds an internal data structure with the users' responses. It
|
||||
is set up like this:
|
||||
|
||||
responses => {
|
||||
__qid__ => {
|
||||
comment => "question comment",
|
||||
},
|
||||
__aid__ => {
|
||||
time => time(),
|
||||
comment => "answer comment",
|
||||
value => "answer value",
|
||||
},
|
||||
}
|
||||
|
||||
=cut
|
||||
|
||||
sub recordResponses {
|
||||
my $self = shift;
|
||||
my $session = shift;
|
||||
|
|
@ -217,7 +411,7 @@ sub recordResponses {
|
|||
#There were no questions in the section just displayed, so increment the lastResponse by one
|
||||
if ( ref $questions ne 'ARRAY' ) {
|
||||
$self->lastResponse( $self->lastResponse + 1 );
|
||||
return [ $terminal, $terminalUrl ];
|
||||
return [ $sterminal, $terminalUrl ];
|
||||
}
|
||||
|
||||
for my $question (@$questions) {
|
||||
|
|
@ -234,7 +428,7 @@ sub recordResponses {
|
|||
{
|
||||
|
||||
$aAnswered = 1;
|
||||
if ( $mcTypes{ $question->{questionType} } ) {
|
||||
if ( exists $mcTypes{ $question->{questionType} } ) {
|
||||
$self->responses->{ $answer->{id} }->{value} = $answer->{recordedAnswer};
|
||||
}
|
||||
else {
|
||||
|
|
@ -253,7 +447,9 @@ sub recordResponses {
|
|||
} ## end if ( defined( $responses...
|
||||
} ## end for my $answer ( @{ $question...
|
||||
$qAnswered = 0 if ( !$aAnswered and $question->{required} );
|
||||
$self->{questionsAnswered}++ if($aAnswered);
|
||||
if ($aAnswered) {
|
||||
$self->questionsAnswered( +1 );
|
||||
}
|
||||
} ## end for my $question (@$questions)
|
||||
|
||||
#if all responses completed, move the lastResponse index to the last question shown
|
||||
|
|
@ -272,6 +468,20 @@ sub recordResponses {
|
|||
return [ $terminal, $terminalUrl ];
|
||||
} ## end sub recordResponses
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 goto ( $variable )
|
||||
|
||||
Looks through all sections and questions for their variable key, in order. If the requested
|
||||
$variable matches a variable, then the lastResponse is set so that that section or question
|
||||
is the next displayed. If more than one section or question matches, then the first is used.
|
||||
|
||||
=head3 $variable
|
||||
|
||||
The variable to look for in all sections and questions.
|
||||
|
||||
=cut
|
||||
|
||||
sub goto {
|
||||
my $self = shift;
|
||||
my $goto = shift;
|
||||
|
|
@ -289,6 +499,12 @@ sub goto {
|
|||
}
|
||||
} ## end sub goto
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getPreviousAnswer
|
||||
|
||||
=cut
|
||||
|
||||
sub getPreviousAnswer {
|
||||
my $self = shift;
|
||||
my $questionParam = shift;
|
||||
|
|
@ -304,12 +520,33 @@ sub getPreviousAnswer {
|
|||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 nextQuestions
|
||||
|
||||
Returns an array ref of the next questions in the survey. The number of questions
|
||||
returned is set by the questionsPerPage property of the next section, as determined
|
||||
by nextSectionId rather than logical section ordering.
|
||||
|
||||
If no questions are available, then it returns an empty array ref.
|
||||
|
||||
Each element of the array ref is a question data structure, from the
|
||||
WebGUI::Asset::Wobject::Survey::SurveyJSON class, with a section sid field (index of
|
||||
the containing section) and question id (section and question id concatenated with a
|
||||
'-') added. The answers array of the question contains answer data structures, also
|
||||
from WebGUI::Asset::Wobject::Survey::SurveyJSON, with an id field which is the section,
|
||||
question and answer indexes concatentated together with dashes.
|
||||
|
||||
Section and question [[var]] replacements in text fields.
|
||||
|
||||
All questions and answers are safe copies of the survey data.
|
||||
|
||||
=cut
|
||||
|
||||
sub nextQuestions {
|
||||
my $self = shift;
|
||||
|
||||
if ( $self->lastResponse >= $#{ $self->surveyOrder } ) {
|
||||
return [];
|
||||
}
|
||||
return [] if $self->surveyEnd;
|
||||
|
||||
my $nextSectionId = $self->nextSectionId;
|
||||
|
||||
|
|
@ -334,22 +571,37 @@ sub nextQuestions {
|
|||
$question{id} = "$$qAddy[0]-$$qAddy[1]";
|
||||
$question{sid} = "$$qAddy[0]";
|
||||
for ( @{ $$qAddy[2] } ) {
|
||||
my $ans = $self->survey->answer( [ $$qAddy[0], $$qAddy[1], $_ ] );
|
||||
$ans->{'text'} =~ s/\[\[([^\%]*?)\]\]/$self->getPreviousAnswer($1)/eg;
|
||||
$ans->{id} = "$$qAddy[0]-$$qAddy[1]-$_";
|
||||
push( @{ $question{answers} }, $ans );
|
||||
my %ans = %{ $self->survey->answer( [ $$qAddy[0], $$qAddy[1], $_ ] ) };
|
||||
$ans{'text'} =~ s/\[\[([^\%]*?)\]\]/$self->getPreviousAnswer($1)/eg;
|
||||
$ans{id} = "$$qAddy[0]-$$qAddy[1]-$_";
|
||||
push( @{ $question{answers} }, \%ans );
|
||||
}
|
||||
push( @$questions, \%question );
|
||||
} ## end for ( my $i = 1; $i <= ...
|
||||
return $questions;
|
||||
} ## end sub nextQuestions
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 surveyEnd
|
||||
|
||||
Returns true if the current index stored in lastResponse is greater than or
|
||||
equal to the number of sections in the survey order.
|
||||
|
||||
=cut
|
||||
|
||||
sub surveyEnd {
|
||||
my $self = shift;
|
||||
return 1 if ( $self->lastResponse >= $#{ $self->surveyOrder } );
|
||||
return 0;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 returnResponsesForReporting
|
||||
|
||||
=cut
|
||||
|
||||
sub returnResponseForReporting {
|
||||
my $self = shift;
|
||||
my @responses = ();
|
||||
|
|
@ -393,19 +645,51 @@ sub returnResponseForReporting {
|
|||
return \@responses;
|
||||
} ## end sub returnResponseForReporting
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
#the actual responses to the survey. A response is for a question and is accessed by the exact same address as a survey member.
|
||||
#Questions only contain the comment and an array of answer Responses.
|
||||
#Answers only contain, entered text, entered verbatim, their index in the Survey Question Answer array, and the assetId to the uploaded file.
|
||||
|
||||
=head2 responses
|
||||
|
||||
Returns a reference to the actual responses to the survey. A response is for a question and
|
||||
is accessed by the exact same address as a survey member. Questions only contain the comment
|
||||
and an array of answer Responses. Answers only contain, entered text, entered verbatim,
|
||||
their index in the Survey Question Answer array, and the assetId to the uploaded file.
|
||||
|
||||
Note, this is an unsafe reference.
|
||||
|
||||
=cut
|
||||
|
||||
sub responses {
|
||||
my $self = shift;
|
||||
return $self->{responses};
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 responses
|
||||
|
||||
Returns a referece to the SurveyJSON object that this object was created with.
|
||||
|
||||
Note, this is an unsafe reference.
|
||||
|
||||
=cut
|
||||
|
||||
sub survey {
|
||||
my $self = shift;
|
||||
return $self->{survey};
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 log
|
||||
|
||||
Logs an error to the webgui log file, using the session logger.
|
||||
|
||||
=cut
|
||||
|
||||
sub log {
|
||||
my ( $self, $message ) = @_;
|
||||
if ( defined $self->{log} ) {
|
||||
|
|
|
|||
|
|
@ -862,7 +862,7 @@ sub getFormElement {
|
|||
}
|
||||
}
|
||||
|
||||
if (WebGUI::Utility::isIn($data->{fieldType},qw(SelectList CheckList SelectBox Attachments Combo))) {
|
||||
if (WebGUI::Utility::isIn($data->{fieldType},qw(SelectList CheckList SelectBox Attachments))) {
|
||||
my @defaultValues;
|
||||
if ($self->session->form->param($name)) {
|
||||
@defaultValues = $self->session->form->selectList($name);
|
||||
|
|
@ -876,7 +876,9 @@ sub getFormElement {
|
|||
$param{value} = \@defaultValues;
|
||||
}
|
||||
|
||||
if (WebGUI::Utility::isIn($data->{fieldType},qw(SelectList SelectBox CheckList RadioList SelectSlider Combo))) {
|
||||
my $class = 'WebGUI::Form::'. ucfirst $data->{fieldType};
|
||||
eval { WebGUI::Pluggable::load($class) };
|
||||
if ($class->isa('WebGUI::Form::List')) {
|
||||
delete $param{size};
|
||||
|
||||
my $values = WebGUI::Operation::Shared::secureEval($self->session,$data->{possibleValues});
|
||||
|
|
@ -930,7 +932,7 @@ sub getFormElement {
|
|||
$param{value} = $data->{value} || $data->{defaultValue};
|
||||
}
|
||||
|
||||
my $formElement = eval { WebGUI::Pluggable::instanciate("WebGUI::Form::". ucfirst $param{fieldType}, "new", [$self->session, \%param ])};
|
||||
my $formElement = eval { WebGUI::Pluggable::instanciate($class, "new", [$self->session, \%param ])};
|
||||
return $formElement->toHtml();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ a:visited { color: '.$form->get("visitedLinkColor").'; }
|
|||
#pageBodyContainer { background-color: '.$form->get("contentBackgroundColor").'; color: '.$form->get("contentTextColor").'; }
|
||||
#mainNavigationContainer { min-height: 300px; padding: 5px; float: left; width: 180px; font-size: 10pt; background-color: '.$form->get("navigationBackgroundColor").'; }
|
||||
#mainNavigationContainer A, #mainNavigationContainer A:link { color: '.$form->get("navigationTextColor").'; }
|
||||
#mainBodyContentContainer { padding: 5px; margin-left: 200px; font-family: serif, times new roman; font-size: 12pt; }
|
||||
#mainBodyContentContainer { padding: 5px; margin-left: 200px; font-family: serif, times new roman; font-size: 12pt; overflow: auto; }
|
||||
#pageFooterContainer { text-align: center; background-color: '.$form->get("footerBackgroundColor").'; color: '.$form->get("footerTextColor").'; }
|
||||
#copyrightContainer { font-size: 8pt; }
|
||||
#pageWidthContainer { width: 80%; margin-left: auto; margin-right: auto; font-family: sans-serif, helvetica, arial; border: 3px solid black; }
|
||||
|
|
|
|||
|
|
@ -115,51 +115,44 @@ sub getName {
|
|||
|
||||
=head2 getValue ( [ value ] )
|
||||
|
||||
If the defaultValue is a MySQL time, the value returned by this form element
|
||||
will be a MySQL time. Note: Will not be adjusted for the user's time zone.
|
||||
If the defaultValue is a MySQL time, or the format property = 'mysql',
|
||||
the value returned by this form element will be a MySQL time.
|
||||
Note: Will not be adjusted for the user's time zone.
|
||||
|
||||
Otherwise, the value returned by this form element will be a number of seconds,
|
||||
adjusted for the user's time zone..
|
||||
Otherwise, the value returned by this form element will be a number of seconds.
|
||||
|
||||
=head3 value
|
||||
|
||||
An optional value to process, instead of POST input. This should be in the form of an integer of seconds, 'HH:MM', or 'HH:MM:SS'.
|
||||
An optional value to process, instead of POST input. This should be
|
||||
in the form of an integer of seconds, 'HH:MM', or 'HH:MM:SS'.
|
||||
|
||||
=cut
|
||||
|
||||
my $mysqlFormattedDate = qr/^\d{2}\D\d{2}(?:\D\d{2})?$/;
|
||||
|
||||
sub getValue {
|
||||
my $self = shift;
|
||||
my $value = $self->SUPER::getValue(@_);
|
||||
if (@_) {
|
||||
if ($self->get('format') ne 'mysql' && (
|
||||
!$self->get("defaultValue")
|
||||
|| $self->get("defaultValue") =~ m/^\d+$/
|
||||
|| !$value
|
||||
|| $value =~ m/^\d+$/)) {
|
||||
return $self->session->datetime->timeToSeconds($value)-($self->session->user->profileField("timeOffset")*3600);
|
||||
}
|
||||
elsif ($value =~ /^\d{2}\D\d{2}(\D\d{2})?$/) {
|
||||
return $value
|
||||
}
|
||||
else {
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
|
||||
# This should probably be rewritten as a cascading ternary
|
||||
if ($self->get('format') ne 'mysql' && (
|
||||
!$self->get("defaultValue")
|
||||
|| $self->get("defaultValue") =~ m/^\d+$/
|
||||
|| !$self->get("value")
|
||||
|| $self->get("value") =~ m/^\d+$/)) {
|
||||
# epoch format
|
||||
return $self->session->datetime->timeToSeconds($value)-($self->session->user->profileField("timeOffset")*3600);
|
||||
}
|
||||
else {
|
||||
# Mysql format
|
||||
return undef unless $value =~ /^\d{2}\D\d{2}(\D\d{2})?$/;
|
||||
return $value;
|
||||
}
|
||||
my $mysqlMode = $self->get('format') eq 'mysql'
|
||||
|| $self->getDefaultValue =~ $mysqlFormattedDate;
|
||||
my $mysqlDate = ($value =~ $mysqlFormattedDate);
|
||||
my $digits = ($value =~ /^\d+/);
|
||||
##Format is fine
|
||||
if ( ( $mysqlMode && $mysqlDate)
|
||||
||(!$mysqlMode && !$mysqlDate) && $digits) {
|
||||
return $value;
|
||||
}
|
||||
##Convert to mysql format
|
||||
elsif ($mysqlMode && $digits) {
|
||||
return $self->session->datetime->secondsToTime($value);
|
||||
}
|
||||
##Convert to seconds.
|
||||
elsif ($mysqlDate) {
|
||||
return $self->session->datetime->timeToSeconds($value);
|
||||
}
|
||||
else { ##Bad stuff, maynard
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
104
lib/WebGUI/Help/PayDriver_ITransact.pm
Normal file
104
lib/WebGUI/Help/PayDriver_ITransact.pm
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
package WebGUI::Help::Shop::PayDriver::ITransact;
|
||||
|
||||
use strict;
|
||||
|
||||
|
||||
our $HELP = {
|
||||
|
||||
'edit credentials template' => {
|
||||
title => 'edit credentials template',
|
||||
body => 'edit credentials template help',
|
||||
isa => [],
|
||||
fields => [],
|
||||
variables => [
|
||||
{
|
||||
name => "errors",
|
||||
description => "errors help",
|
||||
required => 1,
|
||||
},
|
||||
{
|
||||
name => "error",
|
||||
description => "error help",
|
||||
required => 1,
|
||||
},
|
||||
{
|
||||
name => "formHeader",
|
||||
description => "formHeader help",
|
||||
required => 1,
|
||||
namespace => 'Shop',
|
||||
},
|
||||
{
|
||||
name => "formFooter",
|
||||
description => "formFooter help",
|
||||
required => 1,
|
||||
namespace => 'Shop',
|
||||
},
|
||||
{
|
||||
name => "addressField",
|
||||
description => "addressField help",
|
||||
required => 1,
|
||||
},
|
||||
{
|
||||
name => "cityField",
|
||||
description => "cityField help",
|
||||
required => 1,
|
||||
namespace => 'Shop',
|
||||
},
|
||||
{
|
||||
name => "stateField",
|
||||
description => "stateField help",
|
||||
required => 1,
|
||||
namespace => 'Shop',
|
||||
},
|
||||
{
|
||||
name => "countryField",
|
||||
description => "countryField help",
|
||||
required => 1,
|
||||
namespace => 'Shop',
|
||||
},
|
||||
{
|
||||
name => "codeField",
|
||||
description => "codeField help",
|
||||
required => 1,
|
||||
namespace => 'Shop',
|
||||
},
|
||||
{
|
||||
name => "phoneField",
|
||||
description => "phoneNumberField help",
|
||||
required => 1,
|
||||
namespace => 'Shop',
|
||||
},
|
||||
{
|
||||
name => "emailField",
|
||||
description => "emailNumberField help",
|
||||
required => 1,
|
||||
},
|
||||
{
|
||||
name => "cardNumberField",
|
||||
description => "cardNumberField help",
|
||||
required => 1,
|
||||
},
|
||||
{
|
||||
name => "monthYearField",
|
||||
description => "monthYearNumberField help",
|
||||
required => 1,
|
||||
},
|
||||
{
|
||||
name => "cvv2Field",
|
||||
description => "cvv2NumberField help",
|
||||
required => 1,
|
||||
},
|
||||
{
|
||||
name => "checkoutButton",
|
||||
description => "checkoutButton help",
|
||||
required => 1,
|
||||
namespace => 'Shop',
|
||||
},
|
||||
],
|
||||
related => [
|
||||
],
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
@ -120,6 +120,7 @@ sub process {
|
|||
my %assetList = %{$config->get('assets')};
|
||||
foreach my $assetClass (keys %assetList) {
|
||||
my $dummy = WebGUI::Asset->newByPropertyHashRef($session,{dummy=>1, className=>$assetClass});
|
||||
next unless defined $dummy;
|
||||
next if $dummy->getUiLevel($assetList{$assetClass}{uiLevel}) > $userUiLevel;
|
||||
next unless ($dummy->canAdd($session));
|
||||
next unless exists $categories{$assetList{$assetClass}{category}};
|
||||
|
|
|
|||
|
|
@ -337,7 +337,7 @@ sub www_manage {
|
|||
.WebGUI::Form::formFooter($session)
|
||||
|
||||
# Append payment gateway label
|
||||
.' '. $paymentGateway->label()
|
||||
.' '. $paymentGateway->get('label')
|
||||
.'</div>';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,11 +62,10 @@ this plugin.
|
|||
sub getButton {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $i18n = WebGUI::International->new($session, 'PayDriver_Cash');
|
||||
|
||||
my $payForm = WebGUI::Form::formHeader($session)
|
||||
. $self->getDoFormTags('getCredentials')
|
||||
. WebGUI::Form::submit($session, {value => $i18n->get('cash') })
|
||||
. WebGUI::Form::submit($session, {value => $self->get('label') })
|
||||
. WebGUI::Form::formFooter($session);
|
||||
|
||||
return $payForm;
|
||||
|
|
|
|||
|
|
@ -367,6 +367,12 @@ sub definition {
|
|||
label => $i18n->get('use cvv2'),
|
||||
hoverHelp => $i18n->get('use cvv2 help'),
|
||||
},
|
||||
credentialsTemplateId => {
|
||||
fieldType => 'template',
|
||||
label => $i18n->get('credentials template'),
|
||||
hoverHelp => $i18n->get('credentials template help'),
|
||||
namespace => 'Shop/Credentials',
|
||||
},
|
||||
emailMessage => {
|
||||
fieldType => 'textarea',
|
||||
label => $i18n->get('emailMessage'),
|
||||
|
|
@ -430,11 +436,10 @@ sub doXmlRequest {
|
|||
sub getButton {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $i18n = WebGUI::International->new($session, 'PayDriver');
|
||||
|
||||
my $payForm = WebGUI::Form::formHeader($session)
|
||||
. $self->getDoFormTags('getCredentials')
|
||||
. WebGUI::Form::submit($session, {value => $i18n->get('credit card') })
|
||||
. WebGUI::Form::submit($session, {value => $self->get('label') })
|
||||
. WebGUI::Form::formFooter($session);
|
||||
|
||||
return $payForm;
|
||||
|
|
@ -618,91 +623,90 @@ sub www_getCredentials {
|
|||
}
|
||||
|
||||
my $output;
|
||||
my $var = {};
|
||||
|
||||
# Process form errors
|
||||
if ( $errors ) {
|
||||
$var->{errors} = [];
|
||||
#### TODO: i18n
|
||||
$output .= $i18n->get('error occurred message')
|
||||
. '<ul><li>' . join( '</li><li>', @{ $errors } ) . '</li></ul>';
|
||||
if ($errors) {
|
||||
$var->{error_message} = $i18n->get('error occurred message');
|
||||
foreach my $error (@{ $errors} ) {
|
||||
push @{ $var->{errors} }, { error => $error };
|
||||
}
|
||||
}
|
||||
|
||||
$output .= $self->getSelectAddressButton( 'getCredentials' );
|
||||
$var->{getSelectAddressButton} = $self->getSelectAddressButton( 'getCredentials' );
|
||||
$self->session->log->warn("selectAddressButton: ".$var->{getSelectAddressButton});
|
||||
|
||||
$var->{formHeader} = WebGUI::Form::formHeader($session)
|
||||
. $self->getDoFormTags('pay');
|
||||
|
||||
if ($var->{formHeader}) {
|
||||
$var->{formHeader} .= WebGUI::Form::hidden($session, {name => 'addressId', value => $addressId});
|
||||
}
|
||||
|
||||
$var->{formFooter} = WebGUI::Form::formFooter();
|
||||
$self->session->log->warn("formHeader: ".$var->{formHeader});
|
||||
|
||||
my $f = WebGUI::HTMLForm->new( $session );
|
||||
$self->getDoFormTags( 'pay', $f );
|
||||
$f->hidden(
|
||||
-name => 'addressId',
|
||||
-value => $addressId,
|
||||
) if $addressId;
|
||||
|
||||
# Address data form
|
||||
$f->text(
|
||||
-name => 'firstName',
|
||||
-label => $i18n->get('firstName'),
|
||||
-value => $form->process("firstName") || $addressData->{ "firstName" } || $u->profileField('firstName'),
|
||||
);
|
||||
$f->text(
|
||||
-name => 'lastName',
|
||||
-label => $i18n->get('lastName'),
|
||||
-value => $form->process("lastName") || $addressData->{ "lastName" } || $u->profileField('lastName'),
|
||||
);
|
||||
$f->text(
|
||||
-name => 'address',
|
||||
-label => $i18n->get('address'),
|
||||
-value => $form->process("address") || $addressData->{ address1 } || $u->profileField('homeAddress'),
|
||||
);
|
||||
$f->text(
|
||||
-name => 'city',
|
||||
-label => $i18n->get('city'),
|
||||
-value => $form->process("city") || $addressData->{ city } || $u->profileField('homeCity'),
|
||||
);
|
||||
$f->text(
|
||||
-name => 'state',
|
||||
-label => $i18n->get('state'),
|
||||
-value => $form->process("state") || $addressData->{ state } || $u->profileField('homeState'),
|
||||
);
|
||||
$f->zipcode(
|
||||
-name => 'zipcode',
|
||||
-label => $i18n->get('zipcode'),
|
||||
-value => $form->process("zipcode") || $addressData->{ code } || $u->profileField('homeZip'),
|
||||
);
|
||||
$f->country(
|
||||
-name => "country",
|
||||
-label => $i18n->get("country"),
|
||||
-value => ($form->process("country",'country') || $addressData->{ country } || $u->profileField("homeCountry") || 'United States'),
|
||||
);
|
||||
$f->phone(
|
||||
-name => "phone",
|
||||
-label => $i18n->get("phone"),
|
||||
-value => $form->process("phone",'phone') || $addressData->{ phoneNumber } || $u->profileField("homePhone"),
|
||||
);
|
||||
$f->email(
|
||||
-name => 'email',
|
||||
-label => $i18n->get('email'),
|
||||
-value => $self->session->form->process("email") || $u->profileField('email'),
|
||||
);
|
||||
$var->{firstNameField} = WebGUI::Form::text($session, {
|
||||
name => 'firstName',
|
||||
value => $form->process("firstName") || $addressData->{ "firstName" } || $u->profileField('firstName'),
|
||||
});
|
||||
$var->{lastNameField} = WebGUI::Form::text($session, {
|
||||
name => 'lastName',
|
||||
value => $form->process("lastName") || $addressData->{ "lastName" } || $u->profileField('lastName'),
|
||||
});
|
||||
$var->{addressField} = WebGUI::Form::text($session, {
|
||||
name => 'address',
|
||||
value => $form->process("address") || $addressData->{ address1 } || $u->profileField('homeAddress'),
|
||||
});
|
||||
$var->{cityField} = WebGUI::Form::text($session, {
|
||||
name => 'city',
|
||||
value => $form->process("city") || $addressData->{ city } || $u->profileField('homeCity'),
|
||||
});
|
||||
$var->{stateField} = WebGUI::Form::text($session, {
|
||||
name => 'state',
|
||||
value => $form->process("state") || $addressData->{ state } || $u->profileField('homeState'),
|
||||
});
|
||||
$var->{codeField} = WebGUI::Form::zipcode($session, {
|
||||
name => 'zipcode',
|
||||
value => $form->process("zipcode") || $addressData->{ code } || $u->profileField('homeZip'),
|
||||
});
|
||||
$var->{countryField} = WebGUI::Form::country($session, {
|
||||
name => 'country',
|
||||
value => ($form->process("country",'country') || $addressData->{ country } || $u->profileField("homeCountry") || 'United States'),
|
||||
});
|
||||
$var->{phoneField} = WebGUI::Form::phone($session, {
|
||||
name => 'phone',
|
||||
value => $form->process("phone",'phone') || $addressData->{ phoneNumber } || $u->profileField("homePhone"),
|
||||
});
|
||||
$var->{emailField} = WebGUI::Form::email($session, {
|
||||
name => 'email',
|
||||
value => $self->session->form->process("email") || $u->profileField('email'),
|
||||
});
|
||||
|
||||
# Credit card information
|
||||
$f->text(
|
||||
-name => 'cardNumber',
|
||||
-label => $i18n->get('cardNumber'),
|
||||
-value => $self->session->form->process("cardNumber"),
|
||||
);
|
||||
$f->readOnly(
|
||||
-label => $i18n->get('expiration date'),
|
||||
-value => _monthYear( $session ),
|
||||
);
|
||||
$f->integer(
|
||||
-name => 'cvv2',
|
||||
-label => $i18n->get('cvv2'),
|
||||
-value => $self->session->form->process("cvv2")
|
||||
) if ($self->get('useCVV2'));
|
||||
$f->submit(
|
||||
-value => 'Checkout',
|
||||
);
|
||||
|
||||
$output .= $f->print;
|
||||
return $session->style->userStyle( $output );
|
||||
$var->{cardNumberField} = WebGUI::Form::text($session, {
|
||||
name => 'cardNumber',
|
||||
value => $self->session->form->process("cardNumber"),
|
||||
});
|
||||
$var->{monthYearField} = WebGUI::Form::readOnly($session, {
|
||||
value => _monthYear( $session ),
|
||||
});
|
||||
$var->{cvv2Field} = WebGUI::Form::integer($session, {
|
||||
name => 'cvv2',
|
||||
value => $self->session->form->process("cvv2"),
|
||||
}) if $self->get('useCVV2');
|
||||
|
||||
$var->{checkoutButton} = WebGUI::Form::submit($session, {
|
||||
value => $i18n->get('checkout button', 'Shop'),
|
||||
});
|
||||
|
||||
my $template = WebGUI::Asset::Template->new($session, $self->get("credentialsTemplateId"));
|
||||
$template->prepare;
|
||||
return $session->style->userStyle($template->process($var));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -212,6 +212,7 @@ sub execute {
|
|||
feedId => $feed->{feedId},
|
||||
description => _unwrapIcalText($events{$id}->{description}->[1]),
|
||||
title => _unwrapIcalText($events{$id}->{summary}->[1]),
|
||||
location => _unwrapIcalText($events{$id}->{location}->[1]),
|
||||
menuTitle => substr($events{$id}->{summary}->[1],0,15),
|
||||
className => 'WebGUI::Asset::Event',
|
||||
isHidden => 1,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package WebGUI::i18n::English::Account_Profile;
|
||||
package WebGUI::i18n::English::Account;
|
||||
use strict;
|
||||
|
||||
our $I18N = {
|
||||
|
|
|
|||
|
|
@ -619,6 +619,11 @@ listing,|,
|
|||
message => q|Select a template to be used to show the listing comparison data.|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'edit listing template description' => {
|
||||
message => q|Select a template to be used to show the listing edit screen.|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'categories label' => {
|
||||
message => q|Categories|,
|
||||
|
|
@ -745,6 +750,11 @@ listing,|,
|
|||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'edit listing template label' => {
|
||||
message => q|Edit Listing Template|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'product name' => {
|
||||
message => q|Product Name|,
|
||||
lastUpdated => 1133758944,
|
||||
|
|
|
|||
|
|
@ -113,6 +113,17 @@ this listing.|,
|
|||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'product name label' => {
|
||||
message => q|Product Name|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'product name description' => {
|
||||
message => q|Enter the name of the product. If there are entries for the product with different revisions,
|
||||
it would be best to make sure the names are the same.|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'productURL description' => {
|
||||
message => q|If the product has its own website, enter the complete URL for it here.|,
|
||||
lastUpdated => 0,
|
||||
|
|
|
|||
|
|
@ -112,6 +112,109 @@ our $I18N = {
|
|||
},
|
||||
|
||||
|
||||
'credentials template' => {
|
||||
message => q|Credentials Template|,
|
||||
lastUpdated => 0,
|
||||
context => q|Form label in the configuration form of the iTransact module.|
|
||||
},
|
||||
'credentials template help' => {
|
||||
message => q|Pick a template to display the form where the user will enter in their billing information and credit card information.|,
|
||||
lastUpdated => 0,
|
||||
context => q|Hover help for the credentials template field in the configuration form of the iTransact module.|
|
||||
},
|
||||
|
||||
'edit credentials template' => {
|
||||
message => q|Edit Credentials Template|,
|
||||
lastUpdated => 0,
|
||||
context => q|Title of the help page.|
|
||||
},
|
||||
'edit credentials template help' => {
|
||||
message => q|This template is used to display a form to the user where they can enter in contact and credit card billing information.|,
|
||||
lastUpdated => 0,
|
||||
context => q|Title of the help page.|
|
||||
},
|
||||
|
||||
'errors help' => {
|
||||
message => q|A template loop containing a list of errors from processing the form.|,
|
||||
lastUpdated => 0,
|
||||
context => q|Template variable help.|
|
||||
},
|
||||
|
||||
'error help' => {
|
||||
message => q|One error from the errors loop. It will have minimal markup.|,
|
||||
lastUpdated => 0,
|
||||
context => q|Template variable help.|
|
||||
},
|
||||
|
||||
'checkoutButton help' => {
|
||||
message => q|A button with an internationalized label to submit the form and continue the checkout process.|,
|
||||
lastUpdated => 0,
|
||||
context => q|Template variable help.|
|
||||
},
|
||||
|
||||
'addressField help' => {
|
||||
message => q|A single text field for the user to enter in their street address.|,
|
||||
lastUpdated => 0,
|
||||
context => q|Template variable help.|
|
||||
},
|
||||
|
||||
'emailField help' => {
|
||||
message => q|A single text field for the user to enter in their street address.|,
|
||||
lastUpdated => 0,
|
||||
context => q|Template variable help.|
|
||||
},
|
||||
|
||||
'cardNumberField help' => {
|
||||
message => q|A single text field for the user to enter in their credit card number.|,
|
||||
lastUpdated => 0,
|
||||
context => q|Template variable help.|
|
||||
},
|
||||
|
||||
'monthYearField help' => {
|
||||
message => q|A combination form field for the user to enter in the month and year of the expiration date for the credit card.|,
|
||||
lastUpdated => 0,
|
||||
context => q|Template variable help.|
|
||||
},
|
||||
|
||||
'cvv2Field help' => {
|
||||
message => q|A single text field for the user to enter in their credit card verification number. If the PayDriver is not configured to use CVV2, then this field will be empty.|,
|
||||
lastUpdated => 0,
|
||||
context => q|Template variable help.|
|
||||
},
|
||||
|
||||
'password' => {
|
||||
message => q|Password|,
|
||||
lastUpdated => 0,
|
||||
context => q|Form label in the configuration form of the iTransact module.|
|
||||
},
|
||||
'password help' => {
|
||||
message => q|The password for your ITransact account.|,
|
||||
lastUpdated => 0,
|
||||
context => q|Hover help for the password field in the configuration form of the iTransact module.|
|
||||
},
|
||||
|
||||
'password' => {
|
||||
message => q|Password|,
|
||||
lastUpdated => 0,
|
||||
context => q|Form label in the configuration form of the iTransact module.|
|
||||
},
|
||||
'password help' => {
|
||||
message => q|The password for your ITransact account.|,
|
||||
lastUpdated => 0,
|
||||
context => q|Hover help for the password field in the configuration form of the iTransact module.|
|
||||
},
|
||||
|
||||
'credentials template' => {
|
||||
message => q|Credentials Template|,
|
||||
lastUpdated => 0,
|
||||
context => q|Form label in the configuration form of the iTransact module.|
|
||||
},
|
||||
'credentials template help' => {
|
||||
message => q|Pick a template to display the form where the user will enter in their billing information and credit card information.|,
|
||||
lastUpdated => 0,
|
||||
context => q|Hover help for the credentials template field in the configuration form of the iTransact module.|
|
||||
},
|
||||
|
||||
'password' => {
|
||||
message => q|Password|,
|
||||
lastUpdated => 0,
|
||||
|
|
|
|||
|
|
@ -4326,6 +4326,12 @@ Users may override this setting in their profile.
|
|||
context => q{i18n label for time duration in WebGUI::DateTime},
|
||||
},
|
||||
|
||||
'read more' => {
|
||||
message => q|Read More|,
|
||||
lastUpdated => 1229013268,
|
||||
context => q|Template label. Used to indicate that a shortened version of the content is currently displayed and that more can be read by clicking a link.|
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue