Merge branch 'master' into passive_analytics_without_flux
* master: Fixed Survey Take template Squashed commit of the following: (from survey-rfe branch) Fix a POD typo. correct inbox message from user preface Fix a typo in the Default gallery view template Documentation bug in buildArrayRefOfHashRefs changed screenshots in Matrix Listing view to popup matrix privileging fixes Fix an i18n typo in the Post user defined variables. Remove debugging code. approval workflow fix matrix upgrade and privileging fixes fixed: Template parser cannot be set forward porting gallery bug fixes preparing for 7.7.0 dev parser should be a selectbox, not a selectlist. labeling survey as beta fixeding my borkes to the changelog fixed #9852: Users can accept private messages from Visitor, but Visitor cannot send messages
This commit is contained in:
commit
634706efc1
59 changed files with 3833 additions and 2403 deletions
|
|
@ -1,3 +1,9 @@
|
|||
7.7.0
|
||||
- fixed: Template parser cannot be set
|
||||
- fixed #9836: Matrix: Group to Add Listings is missing
|
||||
- fixed #9873: third-> first in post template help
|
||||
- fixed #9892: Typo in "Default Gallery View Album" Template [TEMPLATE]
|
||||
|
||||
7.6.14
|
||||
- fixed: IE6 shows Admin Bar over Asset Manager
|
||||
- fixed #9808: Search i18n
|
||||
|
|
|
|||
|
|
@ -7,6 +7,10 @@ upgrading from one version to the next, or even between multiple
|
|||
versions. Be sure to heed the warnings contained herein as they will
|
||||
save you many hours of grief.
|
||||
|
||||
7.7.0
|
||||
--------------------------------------------------------------------
|
||||
* WebGUI now requires Params::Validate version 0.81 or greater.
|
||||
|
||||
7.6.11
|
||||
--------------------------------------------------------------------
|
||||
* If upgrading from WebGUI 7.5, you should upgrade to 7.5.40 first,
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
BIN
docs/upgrades/packages-7.7.0/matrix-default-screenshots.wgpkg
Normal file
BIN
docs/upgrades/packages-7.7.0/matrix-default-screenshots.wgpkg
Normal file
Binary file not shown.
BIN
docs/upgrades/packages-7.7.0/matrix-default-view-template.wgpkg
Normal file
BIN
docs/upgrades/packages-7.7.0/matrix-default-view-template.wgpkg
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
docs/upgrades/packages-7.7.0/survey-root_import_prop-style.wgpkg
Normal file
BIN
docs/upgrades/packages-7.7.0/survey-root_import_prop-style.wgpkg
Normal file
Binary file not shown.
BIN
docs/upgrades/packages-7.7.0/survey.css.wgpkg
Normal file
BIN
docs/upgrades/packages-7.7.0/survey.css.wgpkg
Normal file
Binary file not shown.
|
|
@ -254,7 +254,7 @@ sub upgradeMatrix {
|
|||
my $session = shift;
|
||||
print "\tUpgrading matrix assets... \n" unless $quiet;
|
||||
my $db = $session->db;
|
||||
$db->write("alter table Matrix drop column groupToRate, drop column groupToAdd, drop column privilegedGroup,
|
||||
$db->write("alter table Matrix drop column groupToRate, drop column privilegedGroup,
|
||||
drop column ratingTimeout, drop column ratingTimeoutPrivileged, drop column ratingDetailTemplateId,
|
||||
drop column visitorCacheTimeout");
|
||||
$db->write("alter table Matrix add column defaultSort char(22) not null default 'score',
|
||||
|
|
@ -337,6 +337,7 @@ sub upgradeMatrix {
|
|||
$listing->{title} = $listing->{productName};
|
||||
$listing->{version} = $listing->{versionNumber};
|
||||
$listing->{screenshots} = $listing->{storageId};
|
||||
$listing->{ownerUserId} = $listing->{maintainerId};
|
||||
$listing->{productURL} = $listing->{productUrl};
|
||||
$listing->{manufacturerURL} = $listing->{manufacturerUrl};
|
||||
my $newMatrixListing = $matrix->addChild($listing,undef,undef,{skipAutoCommitWorkflows=>1});
|
||||
|
|
|
|||
173
docs/upgrades/upgrade_7.6.14-7.7.0.pl
Normal file
173
docs/upgrades/upgrade_7.6.14-7.7.0.pl
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
our ($webguiRoot);
|
||||
|
||||
BEGIN {
|
||||
$webguiRoot = "../..";
|
||||
unshift (@INC, $webguiRoot."/lib");
|
||||
}
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Storage;
|
||||
use WebGUI::Asset;
|
||||
|
||||
|
||||
my $toVersion = '7.7.0';
|
||||
my $quiet; # this line required
|
||||
|
||||
|
||||
my $session = start(); # this line required
|
||||
|
||||
# upgrade functions go here
|
||||
|
||||
addGroupToAddToMatrix( $session );
|
||||
addScreenshotTemplatesToMatrix( $session );
|
||||
surveyDoAfterTimeLimit($session);
|
||||
surveyRemoveResponseTemplate($session);
|
||||
|
||||
finish($session); # this line required
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub addGroupToAddToMatrix {
|
||||
my $session = shift;
|
||||
print "\tAdding groupToAdd to Matrix table, if needed... \n" unless $quiet;
|
||||
my $sth = $session->db->read('describe Matrix groupToAdd');
|
||||
if (! defined $sth->hashRef) {
|
||||
$session->db->write("alter table Matrix add column groupToAdd char(22) default 2");
|
||||
}
|
||||
print "Done.\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub addScreenshotTemplatesToMatrix {
|
||||
my $session = shift;
|
||||
print "\tAdding screenshot templates to Matrix table \n" unless $quiet;
|
||||
|
||||
$session->db->write("alter table Matrix add screenshotsConfigTemplateId char(22);");
|
||||
$session->db->write("update Matrix set screenshotsConfigTemplateId = 'matrixtmpl000000000007';");
|
||||
$session->db->write("alter table Matrix add screenshotsTemplateId char(22);");
|
||||
$session->db->write("update Matrix set screenshotsTemplateId = 'matrixtmpl000000000006';");
|
||||
|
||||
print "Done.\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub surveyDoAfterTimeLimit {
|
||||
my $session = shift;
|
||||
print "\tAdding column doAfterTimeLimit to Survey table... " unless $quiet;
|
||||
$session->db->write('alter table Survey add doAfterTimeLimit char(22)');
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub surveyRemoveResponseTemplate {
|
||||
my $session = shift;
|
||||
print "\tRemoving responseTemplate... " unless $quiet;
|
||||
$session->db->write('alter table Survey drop responseTemplateId');
|
||||
if (my $template = WebGUI::Asset->new($session, 'PBtmpl0000000000000064')) {
|
||||
$template->purge();
|
||||
}
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Describe what our function does
|
||||
#sub exampleFunction {
|
||||
# my $session = shift;
|
||||
# print "\tWe're doing some stuff here that you should know about... " unless $quiet;
|
||||
# # and here's our code
|
||||
# print "DONE!\n" unless $quiet;
|
||||
#}
|
||||
|
||||
|
||||
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Add a package to the import node
|
||||
sub addPackage {
|
||||
my $session = shift;
|
||||
my $file = shift;
|
||||
|
||||
# Make a storage location for the package
|
||||
my $storage = WebGUI::Storage->createTemp( $session );
|
||||
$storage->addFileFromFilesystem( $file );
|
||||
|
||||
# Import the package into the import node
|
||||
my $package = WebGUI::Asset->getImportNode($session)->importPackage( $storage );
|
||||
|
||||
# Make the package not a package anymore
|
||||
$package->update({ isPackage => 0 });
|
||||
|
||||
# Set the default flag for templates added
|
||||
my $assetIds
|
||||
= $package->getLineage( ['self','descendants'], {
|
||||
includeOnlyClasses => [ 'WebGUI::Asset::Template' ],
|
||||
} );
|
||||
for my $assetId ( @{ $assetIds } ) {
|
||||
my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId );
|
||||
if ( !$asset ) {
|
||||
print "Couldn't instantiate asset with ID '$assetId'. Please check package '$file' for corruption.\n";
|
||||
next;
|
||||
}
|
||||
$asset->update( { isDefault => 1 } );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub start {
|
||||
my $configFile;
|
||||
$|=1; #disable output buffering
|
||||
GetOptions(
|
||||
'configFile=s'=>\$configFile,
|
||||
'quiet'=>\$quiet
|
||||
);
|
||||
my $session = WebGUI::Session->open($webguiRoot,$configFile);
|
||||
$session->user({userId=>3});
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->set({name=>"Upgrade to ".$toVersion});
|
||||
return $session;
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub finish {
|
||||
my $session = shift;
|
||||
updateTemplates($session);
|
||||
my $versionTag = WebGUI::VersionTag->getWorking($session);
|
||||
$versionTag->commit;
|
||||
$session->db->write("insert into webguiVersion values (".$session->db->quote($toVersion).",'upgrade',".$session->datetime->time().")");
|
||||
$session->close();
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub updateTemplates {
|
||||
my $session = shift;
|
||||
return undef unless (-d "packages-".$toVersion);
|
||||
print "\tUpdating packages.\n" unless ($quiet);
|
||||
opendir(DIR,"packages-".$toVersion);
|
||||
my @files = readdir(DIR);
|
||||
closedir(DIR);
|
||||
my $newFolder = undef;
|
||||
foreach my $file (@files) {
|
||||
next unless ($file =~ /\.wgpkg$/);
|
||||
# Fix the filename to include a path
|
||||
$file = "packages-" . $toVersion . "/" . $file;
|
||||
addPackage( $session, $file );
|
||||
}
|
||||
}
|
||||
|
||||
#vim:ft=perl
|
||||
|
|
@ -61,7 +61,7 @@ sub upgradeMatrix {
|
|||
my $session = shift;
|
||||
print "\tUpgrading matrix assets... \n" unless $quiet;
|
||||
my $db = $session->db;
|
||||
$db->write("alter table Matrix drop column groupToRate, drop column groupToAdd, drop column privilegedGroup,
|
||||
$db->write("alter table Matrix drop column groupToRate, drop column privilegedGroup,
|
||||
drop column ratingTimeout, drop column ratingTimeoutPrivileged, drop column ratingDetailTemplateId,
|
||||
drop column visitorCacheTimeout");
|
||||
$db->write("alter table Matrix add column defaultSort char(22) not null default 'score',
|
||||
|
|
@ -144,6 +144,7 @@ sub upgradeMatrix {
|
|||
$listing->{title} = $listing->{productName};
|
||||
$listing->{version} = $listing->{versionNumber};
|
||||
$listing->{screenshots} = $listing->{storageId};
|
||||
$listing->{ownerUserId} = $listing->{maintainerId};
|
||||
$listing->{productURL} = $listing->{productUrl};
|
||||
$listing->{manufacturerURL} = $listing->{manufacturerUrl};
|
||||
my $newMatrixListing = $matrix->addChild($listing,undef,undef,{skipAutoCommitWorkflows=>1});
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package WebGUI;
|
||||
|
||||
|
||||
our $VERSION = '7.6.14';
|
||||
our $STATUS = 'stable';
|
||||
our $VERSION = '7.7.0';
|
||||
our $STATUS = 'beta';
|
||||
|
||||
|
||||
=head1 LEGAL
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ sub www_removeFriend {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_removeFriend ( )
|
||||
=head2 www_removeFriendConfirm ( )
|
||||
|
||||
This is a confirmation page of whether or not the user wishes to remove the selected user from friend
|
||||
|
||||
|
|
|
|||
|
|
@ -58,6 +58,43 @@ sub addRevision {
|
|||
return $newSelf;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 canAdd ( )
|
||||
|
||||
Override canAdd to ignore its permissions check. Permissions are handled
|
||||
by the parent Matrix.
|
||||
|
||||
=cut
|
||||
|
||||
sub canAdd {
|
||||
return 1;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 canEdit ( )
|
||||
|
||||
Returns true if the user can edit this asset. C<userId> is a WebGUI user ID.
|
||||
|
||||
Users can edit this Matrix listing if they are the owner, or if they can edit
|
||||
the parent Matrix.
|
||||
|
||||
=cut
|
||||
|
||||
sub canEdit {
|
||||
my $self = shift;
|
||||
|
||||
if ( $self->session->form->process("assetId") eq "new" ) {
|
||||
return $self->getParent->canAddMatrixListing();
|
||||
}
|
||||
else {
|
||||
return 1 if $self->session->user->userId eq $self->get("ownerUserId");
|
||||
|
||||
return $self->getParent->canEdit();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 definition ( session, definition )
|
||||
|
|
@ -327,7 +364,7 @@ sub getEditForm {
|
|||
|
||||
$form->raw(
|
||||
'<tr><td COLSPAN=2>'.
|
||||
WebGUI::Form::Button($session, {}).
|
||||
WebGUI::Form::Submit($session, {}).
|
||||
WebGUI::Form::Button($session, {
|
||||
-value => $i18n->get('cancel', 'WebGUI'),
|
||||
-extras => q|onclick="history.go(-1);" class="backwardButton"|
|
||||
|
|
@ -580,6 +617,14 @@ sub view {
|
|||
if ($emailSent){
|
||||
$var->{emailSent} = 1;
|
||||
}
|
||||
|
||||
unless($self->hasBeenCommitted){
|
||||
my $workflowInstanceId = $db->quickScalar("select workflowInstanceId from assetVersionTag where tagId =?"
|
||||
,[$self->get('tagId')]);
|
||||
$var->{canApprove} = $self->getParent->canEdit;
|
||||
$var->{approveOrDenyUrl} = $self->getUrl("op=manageRevisionsInTag;workflowInstanceId=".$workflowInstanceId
|
||||
.";tagId=".$self->get('tagId'));
|
||||
}
|
||||
$var->{canEdit} = $self->canEdit;
|
||||
$var->{editUrl} = $self->getUrl("func=edit");
|
||||
$var->{controls} = $self->getToolbar;
|
||||
|
|
@ -647,33 +692,10 @@ sub view {
|
|||
my $storage = $file->getStorageLocation;
|
||||
my @files;
|
||||
@files = @{ $storage->getFiles } if (defined $storage);
|
||||
|
||||
$var->{screenshots} = qq|
|
||||
<script type="text/javascript" src="/extras/ukplayer/swfobject.js"></script>
|
||||
<script type="text/javascript">
|
||||
swfobject.registerObject("myFlashContent","9.0.0","/extras/ukplayer/expressInstall.swf");
|
||||
</script>
|
||||
<div>
|
||||
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="400" height="300" id="myFlashContent">
|
||||
<param name="movie" value="/extras/ukplayer/slideShow.swf" />
|
||||
<param name="flashvars" value="config=?func=getScreenshotsConfig" />
|
||||
<!--[if !IE]>-->
|
||||
<object type="application/x-shockwave-flash" data="/extras/ukplayer/slideShow.swf" width="400"
|
||||
height="300">
|
||||
<param name="flashvars" value="config=?func=getScreenshotsConfig" />
|
||||
<!--<![endif]-->
|
||||
<a href="http:/www.adobe.com/go/getflashplayer">
|
||||
<img src="http:/www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe
|
||||
Flash player" />
|
||||
</a>
|
||||
<!--[if !IE]>-->
|
||||
</object>
|
||||
<!--<![endif]-->
|
||||
</object>
|
||||
</div>
|
||||
|;
|
||||
$var->{screenshotsUrl} = $self->getUrl('func=viewScreenshots');
|
||||
$var->{screenshotThumbnail} = $storage->getUrl('thumb-'.$files[0]);
|
||||
}
|
||||
|
||||
|
||||
# Rating form
|
||||
|
||||
my %rating;
|
||||
|
|
@ -835,12 +857,14 @@ Web facing method which is the default edit page
|
|||
|
||||
sub www_edit {
|
||||
my $self = shift;
|
||||
|
||||
return $self->session->privilege->noAccess() unless $self->getParent->canAddMatrixListing();
|
||||
|
||||
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;
|
||||
|
||||
if($self->session->form->process('func') eq 'add'){
|
||||
return $self->session->privilege->noAccess() unless $self->getParent->canAddMatrixListing();
|
||||
}else{
|
||||
return $self->session->privilege->insufficient() unless $self->canEdit;
|
||||
return $self->session->privilege->locked() unless $self->canEditIfLocked;
|
||||
}
|
||||
|
||||
my $var = $self->get;
|
||||
my $matrix = $self->getParent;
|
||||
|
|
@ -930,9 +954,7 @@ sub www_getScreenshots {
|
|||
my $thumb = 'thumb-'.$file;
|
||||
$xml .= "
|
||||
<slide>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
<title><![CDATA[<b>Slide</b> One]]></title>
|
||||
<title></title>
|
||||
<description><![CDATA[ Screenshots ]]></description>
|
||||
<image_source>".$storage->getUrl($file)."</image_source>
|
||||
<duration>5</duration>
|
||||
|
|
@ -960,56 +982,14 @@ Returns the xml config file for the ukplayer that displays the screenshots.
|
|||
=cut
|
||||
|
||||
sub www_getScreenshotsConfig {
|
||||
my $self = shift;
|
||||
my $self = shift;
|
||||
my $var = $self->get;
|
||||
|
||||
return $self->session->privilege->noAccess() unless $self->canView;
|
||||
|
||||
$self->session->http->setMimeType('text/xml');
|
||||
|
||||
my $xml = qq|<?xml version="1.0" encoding="UTF-8"?>
|
||||
<config>
|
||||
|
||||
<content_url>?func=getScreenshots</content_url>
|
||||
|
||||
<width>400</width><!-- this value is overwritten by the flashVars but the tag needs to be here (and it is
|
||||
useful for offline testing) -->
|
||||
<height>300</height><!-- this value is overwritten by the flashVars but the tag needs to be here (and it is
|
||||
useful for offline testing) -->
|
||||
<background_color>0xDDDDEE</background_color>
|
||||
<default_duration>20</default_duration>
|
||||
<default_slidewidth>100</default_slidewidth>
|
||||
<default_slideheight>100</default_slideheight>
|
||||
|
||||
<font>Verdana</font>
|
||||
<font_size>12</font_size>
|
||||
<font_color>0xCCCCCC</font_color>
|
||||
<text_border_color>0xCCCCCC</text_border_color>
|
||||
<text_bg_color>0x000000</text_bg_color>
|
||||
<text_autohide>true</text_autohide>
|
||||
|
||||
<controls_color>0xCCCCCC</controls_color>
|
||||
<controls_border_color>0xCCCCCC</controls_border_color>
|
||||
<controls_bg_color>0x000000</controls_bg_color>
|
||||
<controls_autohide>false</controls_autohide>
|
||||
|
||||
<thumbnail_width>48</thumbnail_width>
|
||||
<thumbnail_height>36</thumbnail_height>
|
||||
<thumbnail_border_color>0x000000</thumbnail_border_color>
|
||||
<menu_autohide>true</menu_autohide>
|
||||
<menu_dead_zone_width>100</menu_dead_zone_width>
|
||||
<menu_gaps>5</menu_gaps>
|
||||
|
||||
<mute_at_start>false</mute_at_start>
|
||||
<autostart>true</autostart>
|
||||
<autopause>false</autopause>
|
||||
<loop>false</loop>
|
||||
<error_message_content><![CDATA[XML not found: ]]></error_message_content>
|
||||
<error_message_image><![CDATA[Image not found]]></error_message_image>
|
||||
|
||||
</config>
|
||||
|;
|
||||
|
||||
return $xml;
|
||||
return $self->processTemplate($var,$self->getParent->get("screenshotsConfigTemplateId"));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -1117,7 +1097,24 @@ sub www_view {
|
|||
return $self->view;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_viewScreenshots ( )
|
||||
|
||||
Returns this listing's screenshots in a ukplayer.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_viewScreenshots {
|
||||
my $self = shift;
|
||||
my $var = $self->get;
|
||||
|
||||
$var->{configUrl} = 'config='.$self->getUrl("func=getScreenshotsConfig");
|
||||
|
||||
return $self->session->privilege->noAccess() unless $self->canView;
|
||||
|
||||
return $self->processTemplate($var,$self->getParent->get("screenshotsTemplateId"));
|
||||
}
|
||||
1;
|
||||
|
||||
#vim:ft=perl
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ sub definition {
|
|||
},
|
||||
parser => {
|
||||
noFormPost => 1,
|
||||
fieldType => 'selectList',
|
||||
fieldType => 'selectBox',
|
||||
defaultValue => [$session->config->get("defaultTemplateParser")],
|
||||
},
|
||||
namespace => {
|
||||
|
|
@ -144,6 +144,7 @@ sub processPropertiesFromFormPost {
|
|||
my %data;
|
||||
my $needsUpdate = 0;
|
||||
if ($self->getValue("parser") ne $self->session->form->process("parser","className") && ($self->session->form->process("parser","className") ne "")) {
|
||||
$needsUpdate = 1;
|
||||
if (isIn($self->session->form->process("parser","className"),@{$self->session->config->get("templateParsers")})) {
|
||||
%data = ( parser => $self->session->form->process("parser","className") );
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1104,6 +1104,7 @@ sub www_addAlbumService {
|
|||
description => $form->get('synopsis','textarea'),
|
||||
synopsis => $form->get('synopsis','textarea'),
|
||||
othersCanAdd => $form->get('othersCanAdd','yesNo'),
|
||||
ownerUserId => $session->user->userId,
|
||||
});
|
||||
|
||||
$album->requestAutoCommit;
|
||||
|
|
|
|||
|
|
@ -1019,6 +1019,7 @@ sub www_addFileService {
|
|||
title => $form->get('title','text'),
|
||||
description => $form->get('synopsis','textarea'),
|
||||
synopsis => $form->get('synopsis','textarea'),
|
||||
ownerUserId => $session->user->userId,
|
||||
});
|
||||
|
||||
my $storage = $file->getStorageLocation;
|
||||
|
|
|
|||
|
|
@ -30,10 +30,46 @@ Returns true if able to add MatrixListings.
|
|||
|
||||
sub canAddMatrixListing {
|
||||
my $self = shift;
|
||||
my $user = $self->session->user;
|
||||
|
||||
return 0 if $self->session->user->isVisitor;
|
||||
# Users in the groupToAdd group can add listings
|
||||
if ( $user->isInGroup( $self->get("groupToAdd") ) ) {
|
||||
return 1;
|
||||
}
|
||||
# Users who can edit matrix can add listings
|
||||
else {
|
||||
return $self->canEdit;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 canEdit ( [userId] )
|
||||
|
||||
Returns true if the user can edit this Matrix.
|
||||
|
||||
Also checks if a user is adding a Matrix Listing and allows them to if they are
|
||||
part of the C<groupToAdd> group.
|
||||
|
||||
=cut
|
||||
|
||||
sub canEdit {
|
||||
my $self = shift;
|
||||
my $userId = shift || $self->session->user->userId;
|
||||
|
||||
my $form = $self->session->form;
|
||||
if ( $form->get('func') eq "editSave" && $form->get('assetId') eq "new" && $form->get( 'class' )->isa(
|
||||
'WebGUI::Asset::MatrixListing' ) ) {
|
||||
return $self->canAddMatrixListing();
|
||||
}
|
||||
else {
|
||||
if ($userId eq $self->get("ownerUserId")) {
|
||||
return 1;
|
||||
}
|
||||
my $user = WebGUI::User->new($self->session, $userId);
|
||||
return $user->isInGroup($self->get("groupIdEdit"));
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -94,6 +130,22 @@ sub definition {
|
|||
hoverHelp =>$i18n->get('edit listing template description'),
|
||||
label =>$i18n->get('edit listing template label'),
|
||||
},
|
||||
screenshotsTemplateId=>{
|
||||
defaultValue =>"matrixtmpl000000000006",
|
||||
fieldType =>"template",
|
||||
tab =>"display",
|
||||
namespace =>"Matrix/Screenshots",
|
||||
hoverHelp =>$i18n->get('screenshots template description'),
|
||||
label =>$i18n->get('screenshots template label'),
|
||||
},
|
||||
screenshotsConfigTemplateId=>{
|
||||
defaultValue =>"matrixtmpl000000000007",
|
||||
fieldType =>"template",
|
||||
tab =>"display",
|
||||
namespace =>"Matrix/ScreenshotsConfig",
|
||||
hoverHelp =>$i18n->get('screenshots config template description'),
|
||||
label =>$i18n->get('screenshots config template label'),
|
||||
},
|
||||
defaultSort=>{
|
||||
fieldType =>"selectBox",
|
||||
tab =>"display",
|
||||
|
|
@ -164,6 +216,13 @@ sub definition {
|
|||
hoverHelp =>$i18n->get('max comparisons privileged description'),
|
||||
label =>$i18n->get('max comparisons privileged label'),
|
||||
},
|
||||
groupToAdd=>{
|
||||
fieldType =>"group",
|
||||
tab =>"security",
|
||||
defaultValue =>2,
|
||||
hoverHelp =>$i18n->get('group to add description'),
|
||||
label =>$i18n->get('group to add label'),
|
||||
},
|
||||
submissionApprovalWorkflowId=>{
|
||||
fieldType =>"workflow",
|
||||
tab =>"security",
|
||||
|
|
@ -543,7 +602,8 @@ sub view {
|
|||
}) };
|
||||
foreach my $pendingListing (@pendingListings){
|
||||
push (@{ $var->{pending_loop} }, {
|
||||
url => $pendingListing->getUrl,
|
||||
url => $pendingListing->getUrl
|
||||
."?func=view;revision=".$pendingListing->get('revisionDate'),
|
||||
name => $pendingListing->get('title'),
|
||||
});
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -14,6 +14,10 @@ our $HELP = {
|
|||
},
|
||||
],
|
||||
variables => [
|
||||
{ 'name' => 'canEdit' },
|
||||
{ 'name' => 'editUrl' },
|
||||
{ 'name' => 'canApprove' },
|
||||
{ 'name' => 'approveOrDenyUrl' },
|
||||
{ 'name' => 'screenshots' },
|
||||
{ 'name' => 'emailForm' },
|
||||
{ 'name' => 'emailSent' },
|
||||
|
|
|
|||
|
|
@ -220,12 +220,13 @@ sub buildHashRef {
|
|||
|
||||
=head2 buildArrayRefOfHashRefs ( sql )
|
||||
|
||||
Builds an array reference of hash references of data
|
||||
from a series of rows. Useful for returning many rows at once.
|
||||
Builds an array reference of hash references of data from a series of rows.
|
||||
Useful for returning many rows at once. Each element of the returned array
|
||||
reference is a hash of column names to column values.
|
||||
|
||||
=head3 sql
|
||||
|
||||
An SQL query. The query must select at least two columns of data, the first being the key for the hash, the second being the value. If the query selects more than two columns, then the last column will be the value and the remaining columns will be joined together by a colon ":" to form a complex key. If the query selects only one column, then the key and the value will be the same.
|
||||
An SQL query.
|
||||
|
||||
=head3 params
|
||||
|
||||
|
|
|
|||
|
|
@ -120,6 +120,7 @@ sub acceptsPrivateMessages {
|
|||
my $userId = shift;
|
||||
|
||||
return 0 if ($self->isVisitor); #Visitor can't get private messages
|
||||
return 0 if ($userId eq "1"); # Visitor can't send private messages
|
||||
return 0 if ($self->userId eq $userId); #Can't send private messages to yourself
|
||||
|
||||
my $pmSetting = $self->profileField('allowPrivateMessages');
|
||||
|
|
|
|||
152
lib/WebGUI/Workflow/Activity/ExpireIncompleteSurveyResponses.pm
Normal file
152
lib/WebGUI/Workflow/Activity/ExpireIncompleteSurveyResponses.pm
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
package WebGUI::Workflow::Activity::ExpireIncompleteSurveyResponses;
|
||||
|
||||
|
||||
=head1 LEGAL
|
||||
|
||||
-------------------------------------------------------------------
|
||||
WebGUI is Copyright 2001-2008 Plain Black Corporation.
|
||||
-------------------------------------------------------------------
|
||||
Please read the legal notices (docs/legal.txt) and the license
|
||||
(docs/license.txt) that came with this distribution before using
|
||||
this software.
|
||||
-------------------------------------------------------------------
|
||||
http://www.plainblack.com info@plainblack.com
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use base 'WebGUI::Workflow::Activity';
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::DateTime;
|
||||
use DateTime::Duration;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Workflow::Activity::ExpireIncompleteSurveyResponses
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This activity deletes the survey responses for which the allowed time has expired and emails the survey user.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
See WebGUI::Workflow::Activity for details on how to use any activity.
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
These methods are available from this class:
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 definition ( session, definition )
|
||||
|
||||
See WebGUI::Workflow::Activity::defintion() for details.
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $definition = shift;
|
||||
my $i18n = WebGUI::International->new($session, "Workflow_Activity_ExpireIncompleteSurveyResponses");
|
||||
push(@{$definition}, {
|
||||
name => $i18n->get("name"),
|
||||
properties => {
|
||||
deleteExpired=>{
|
||||
fieldType=>"yesNo",
|
||||
defaultValue=>0,
|
||||
label=>$i18n->get("Delete expired survey responses"),
|
||||
hoverHelp=>$i18n->get("delete expired")
|
||||
},
|
||||
emailUsers=>{
|
||||
fieldType=>"yesNo",
|
||||
defaultValue=>0,
|
||||
label=>$i18n->get("Email users that responses were deleted"),
|
||||
hoverHelp=>$i18n->get("email users")
|
||||
},
|
||||
emailTemplateId => {
|
||||
fieldType => "template",
|
||||
defaultValue => 'ExpireIncResptmpl00001',
|
||||
namespace => "ExpireIncompleteSurveyResponses",
|
||||
label => $i18n->get('Email template sent to user'),
|
||||
hoverHelp => $i18n->get('email template'),
|
||||
},
|
||||
from => {
|
||||
fieldType=>"text",
|
||||
label=>$i18n->get("from"),
|
||||
defaultValue=>$session->setting->get("companyEmail"),
|
||||
hoverHelp=>$i18n->get("from mouse over"),
|
||||
},
|
||||
subject => {
|
||||
fieldType=>"text",
|
||||
label=>$i18n->get("subject", 'WebGUI'),
|
||||
defaultValue=>"Expired Survey",
|
||||
hoverHelp=>$i18n->get("subject mouse over"),
|
||||
},
|
||||
}
|
||||
});
|
||||
return $class->SUPER::definition($session,$definition);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 execute ( [ object ] )
|
||||
|
||||
Finds all the expired Survey Responses on the system. If delete is selected, they are removed. Then if
|
||||
email is selected, the users are emailed the template.
|
||||
|
||||
=cut
|
||||
|
||||
sub execute {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
|
||||
my $sql = "select r.Survey_responseId, r.username, r.userId, upd.email,upd.firstName,upd.lastName, r.startDate, s.timeLimit, ad.title, ad.url
|
||||
from Survey s, Survey_response r, assetData ad, userProfileData upd
|
||||
where r.isComplete = 0 and s.timeLimit > 0 and (unix_timestamp() - r.startDate) > (s.timeLimit * 60)
|
||||
and r.assetId = s.assetId and s.revisionDate = (select max(revisionDate) from Survey where assetId = s.assetId)
|
||||
and ad.assetId = s.assetId and ad.revisionDate = s.revisionDate and upd.userId = r.userId";
|
||||
my $refs = $self->session->db->buildArrayRefOfHashRefs($sql);
|
||||
for my $ref (@{$refs}) {
|
||||
if($self->get("deleteExpired") == 1){
|
||||
$self->session->db->write("delete from Survey_response where Survey_responseId = ?",[$ref->{Survey_responseId}]);
|
||||
}else{#else sent to expired but not deleted
|
||||
$self->session->db->write("update Survey_response set isComplete = 99 where Survey_responseId = ?",[$ref->{Survey_responseId}]);
|
||||
}
|
||||
if($self->get("emailUsers") == 1 && $ref->{email} =~ /\@/){
|
||||
|
||||
my $var = {
|
||||
to => $ref->{email},
|
||||
from => $self->get("from"),
|
||||
firstName => $ref->{firstName},
|
||||
lastName => $ref->{lastName},
|
||||
surveyTitle => $ref->{title},
|
||||
surveyUrl => $ref->{url},
|
||||
responseId => $ref->{Survey_responseId},
|
||||
deleted => $self->get("deleteExpired"),
|
||||
companyName => $self->session->setting->get("companyName"),
|
||||
};
|
||||
my $template = WebGUI::Asset->newByDynamicClass($self->session,$self->get('emailTemplateId'));
|
||||
my $message = $template->processTemplate($var, $self->get("emailTemplateId"));
|
||||
WebGUI::Macro::process($self->session,\$message);
|
||||
my $mail = WebGUI::Mail::Send->create($self->session,{
|
||||
to => $ref->{email},
|
||||
subject => $self->get("subject"),
|
||||
from => $self->get('from'),
|
||||
});
|
||||
$mail->addHtml($message);
|
||||
$mail->addFooter;
|
||||
$mail->queue;
|
||||
}
|
||||
}
|
||||
return $self->COMPLETE;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
|
|
@ -342,8 +342,10 @@ sub setMessageCompleted {
|
|||
|
||||
# Set all messages to completed
|
||||
for my $messageId ( split /,/, $instance->getScratch("messageId") ) {
|
||||
my $message = $inbox->getMessage( $messageId );
|
||||
$message->setCompleted;
|
||||
if($messageId){
|
||||
my $message = $inbox->getMessage( $messageId );
|
||||
$message->setCompleted;
|
||||
}
|
||||
}
|
||||
|
||||
$instance->deleteScratch( "messageId" );
|
||||
|
|
|
|||
|
|
@ -372,6 +372,11 @@ listing,|,
|
|||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'group to add description' => {
|
||||
message => q|Select the group that is allowed to add listings to this matrix.|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'ratings duration description' => {
|
||||
message => q|Select the interval after which old ratings are cleaned out.|,
|
||||
lastUpdated => 0,
|
||||
|
|
@ -476,6 +481,16 @@ listing,|,
|
|||
message => q|Select a template to be used to show the listing edit screen.|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'screenshots template description' => {
|
||||
message => q|Select a template to be used to show a listing's screenshots.|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'screenshots config template description' => {
|
||||
message => q|Select a template for a listing's screenshots configuration.|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'categories label' => {
|
||||
message => q|Categories|,
|
||||
|
|
@ -487,6 +502,11 @@ listing,|,
|
|||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'group to add label' => {
|
||||
message => q|Group To Add|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'ratings duration label' => {
|
||||
message => q|Ratings Duration|,
|
||||
lastUpdated => 0,
|
||||
|
|
@ -602,6 +622,16 @@ listing,|,
|
|||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'screenshots template label' => {
|
||||
message => q|Listing Screenshots Template|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'screenshots config template label' => {
|
||||
message => q|Listing Screenshots Config Template|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'edit listing template label' => {
|
||||
message => q|Edit Listing Template|,
|
||||
lastUpdated => 0,
|
||||
|
|
@ -750,6 +780,12 @@ selectBox.</p>|
|
|||
message => q|Hide/show stickied|,
|
||||
},
|
||||
|
||||
'approve or deny label' => {
|
||||
lastUpdated => 0,
|
||||
message => q|Approve/Deny|,
|
||||
context => q|Label for the approve or deny link on the matrix listing detail screen.|,
|
||||
},
|
||||
|
||||
'matrix asset template variables title' => {
|
||||
lastUpdated => 0,
|
||||
message => q|Matrix Asset Template Variables|,
|
||||
|
|
|
|||
|
|
@ -44,6 +44,11 @@ fields below.|,
|
|||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'edit label' => {
|
||||
message => q|Edit|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'version description' => {
|
||||
message => q|Enter the version/edition/model number for the product.|,
|
||||
lastUpdated => 0,
|
||||
|
|
@ -221,6 +226,30 @@ it would be best to make sure the names are the same.|,
|
|||
context => q|Description of the form tmpl_var for the template help.|,
|
||||
},
|
||||
|
||||
'canEdit' => {
|
||||
message => q|A boolean indicating whether the user can edit this listing.|,
|
||||
lastUpdated => 0,
|
||||
context => q|Description of the screenshots tmpl_var for the template help.|,
|
||||
},
|
||||
|
||||
'editUrl' => {
|
||||
message => q|The url to this listing's edit screen.|,
|
||||
lastUpdated => 0,
|
||||
context => q|Description of the screenshots tmpl_var for the template help.|,
|
||||
},
|
||||
|
||||
'canApprove' => {
|
||||
message => q|A boolean indicating whether the user can approve or deny this listing.|,
|
||||
lastUpdated => 0,
|
||||
context => q|Description of the screenshots tmpl_var for the template help.|,
|
||||
},
|
||||
|
||||
'approveOrDenyUrl' => {
|
||||
message => q|The url to this listing's approve or deny screen.|,
|
||||
lastUpdated => 0,
|
||||
context => q|Description of the screenshots tmpl_var for the template help.|,
|
||||
},
|
||||
|
||||
'screenshots' => {
|
||||
message => q|This listings screenshots displayed using the ukplayer.|,
|
||||
lastUpdated => 0,
|
||||
|
|
|
|||
|
|
@ -487,8 +487,8 @@ editing an existing Post, and a thread containing the Post exists.|,
|
|||
},
|
||||
|
||||
'userDefined3' => {
|
||||
message => q|The value contained in the first user defined variable.|,
|
||||
lastUpdated => 1150167057,
|
||||
message => q|The value contained in the third user defined variable.|,
|
||||
lastUpdated => 1236354498,
|
||||
},
|
||||
|
||||
'userDefined4' => {
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ use strict;
|
|||
our $I18N = {
|
||||
|
||||
'assetName' => {
|
||||
message => q|Survey|,
|
||||
lastUpdated => 1224686319
|
||||
message => q|Survey (beta)|,
|
||||
lastUpdated => 1236187015
|
||||
},
|
||||
'edit survey' => {
|
||||
message => q|Edit Survey|,
|
||||
|
|
@ -31,6 +31,10 @@ our $I18N = {
|
|||
message => q|View Grade Book|,
|
||||
lastUpdated => 1224686319
|
||||
},
|
||||
'delete responses' => {
|
||||
message => q|Delete Responses|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
'continue button' => {
|
||||
message => q|Continue|,
|
||||
lastUpdated => 1224686319
|
||||
|
|
@ -83,7 +87,7 @@ our $I18N = {
|
|||
},
|
||||
|
||||
'section name' => {
|
||||
message => q|Section name:|,
|
||||
message => q|Section title:|,
|
||||
lastUpdated => 1224686319
|
||||
},
|
||||
'section name description' => {
|
||||
|
|
@ -101,7 +105,7 @@ our $I18N = {
|
|||
lastUpdated => 0
|
||||
},
|
||||
'section custom variable name' => {
|
||||
message => q|Section custom variable name:|,
|
||||
message => q|Section variable name:|,
|
||||
lastUpdated => 1224686319
|
||||
},
|
||||
'section custom variable name description' => {
|
||||
|
|
@ -110,7 +114,7 @@ our $I18N = {
|
|||
lastUpdated => 0
|
||||
},
|
||||
'section branch goto variable name' => {
|
||||
message => q|Section branch goto variable name:|,
|
||||
message => q|Jump to:|,
|
||||
lastUpdated => 1224686319
|
||||
},
|
||||
'section branch goto variable name description' => {
|
||||
|
|
@ -222,6 +226,10 @@ our $I18N = {
|
|||
message => q|Question type:|,
|
||||
lastUpdated => 1224686319
|
||||
},
|
||||
'randomized words' => {
|
||||
message => q|Randomized words:|,
|
||||
lastUpdated => 1224686319
|
||||
},
|
||||
'question type description' => {
|
||||
message => q|Select this question's field type.|,
|
||||
context => q|Description of the 'question type' field, used as hoverhelp in the edit question dialog.|,
|
||||
|
|
@ -256,21 +264,21 @@ our $I18N = {
|
|||
context => q|Description of the 'allow comment' field, used as hoverhelp in the edit question dialog.|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
'cols' => {
|
||||
message => q|Cols:|,
|
||||
'comment cols' => {
|
||||
message => q|Comment Cols:|,
|
||||
lastUpdated => 1224686319
|
||||
},
|
||||
'cols description' => {
|
||||
message => q|The number of columns of the textarea input.|,
|
||||
message => q|The number of columns used for the comment TextArea input field.|,
|
||||
context => q|Description of the 'cols' field, used as hoverhelp in the edit question dialog.|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
'rows' => {
|
||||
message => q|Rows:|,
|
||||
'comment rows' => {
|
||||
message => q|Comment Rows:|,
|
||||
lastUpdated => 1224686319
|
||||
},
|
||||
'rows description' => {
|
||||
message => q|The number of rows of the textarea input.|,
|
||||
message => q|The number of rows shown for the comment TextArea input field.|,
|
||||
context => q|Description of the 'rows' field, used as hoverhelp in the edit question dialog.|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
|
|
@ -325,11 +333,11 @@ our $I18N = {
|
|||
lastUpdated => 0
|
||||
},
|
||||
'recorded answer' => {
|
||||
message => q|Recorded answer:|,
|
||||
message => q|Answer title:|,
|
||||
lastUpdated => 1224686319
|
||||
},
|
||||
'recorded answer description' => {
|
||||
message => q|The answer that will be recorded in the database. The recorded answer will be displayed in a multiple choice question's buttons, only if the question's 'Show text in button' property is set to yes. Otherwise the multiple choice buttons will be empty. |,
|
||||
message => q|Text to display inside multiple-choice answer buttons (only if 'Show text in button' is enabled for this question).|,
|
||||
context => q|Description of the 'recorded answer' field, used as hoverhelp in the edit answer dialog.|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
|
|
@ -337,13 +345,22 @@ our $I18N = {
|
|||
message => q|Jump to:|,
|
||||
lastUpdated => 1224686319
|
||||
},
|
||||
'jump expression' => {
|
||||
message => q|Jump expression:|,
|
||||
lastUpdated => 1229318805
|
||||
},
|
||||
'jump to description' => {
|
||||
message => q|The section or question with this variable name will be the next to be displayed after this answer.|,
|
||||
context => q|Description of the 'jump to' field, used as hoverhelp in the edit answer dialog.|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
'jump expression description' => {
|
||||
message => q|An expression used to control complex branching based user responses to previous questions. A branch expression is made up of a list of rules, one per line, along with a branch target for each rule. |,
|
||||
context => q|Description of the 'jump expression' field, used as hoverhelp in the edit answer dialog.|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
'text answer' => {
|
||||
message => q|Text answer|,
|
||||
message => q|TextArea|,
|
||||
lastUpdated => 1224686319
|
||||
},
|
||||
'is this the correct answer' => {
|
||||
|
|
@ -363,30 +380,30 @@ our $I18N = {
|
|||
message => q|No|,
|
||||
lastUpdated => 1224686319
|
||||
},
|
||||
'min' => {
|
||||
message => q|Min|,
|
||||
'min label' => {
|
||||
message => q|Slider Min|,
|
||||
lastUpdated => 1224686319
|
||||
},
|
||||
'min description' => {
|
||||
message => q|Set the min value of this answer for slider type questions.|,
|
||||
message => q|The minimum value of this answer for slider type questions.|,
|
||||
context => q|Description of the 'min' field, used as hoverhelp in the edit answer dialog.|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
'max label' => {
|
||||
message => q|Max|,
|
||||
message => q|Slider Max|,
|
||||
lastUpdated => 1224686319
|
||||
},
|
||||
'max description' => {
|
||||
message => q|Set the max value of this answer for slider type questions.|,
|
||||
message => q|The maximum value of this answer for slider type questions.|,
|
||||
context => q|Description of the 'max' field, used as hoverhelp in the edit answer dialog.|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
'step label' => {
|
||||
message => q|Step|,
|
||||
message => q|Slider Step|,
|
||||
lastUpdated => 1224686319
|
||||
},
|
||||
'step description' => {
|
||||
message => q|Set the step value of this answer for slider type questions.|,
|
||||
message => q|The step value of this answer for slider type questions.|,
|
||||
context => q|Description of the 'step' field, used as hoverhelp in the edit answer dialog.|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
|
|
@ -395,7 +412,7 @@ our $I18N = {
|
|||
lastUpdated => 1224686319
|
||||
},
|
||||
'verbatim description' => {
|
||||
message => q|Set to yes to add an extra text input to the answer, where the user can enter a single line of text.|,
|
||||
message => q|Set to yes to add an extra text input to the answer, where the user can enter a single line of text. Typically used to permit a free-text 'other' response.|,
|
||||
context => q|Description of the 'verbatim' field, used as hoverhelp in the edit answer dialog.|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
|
|
@ -404,7 +421,7 @@ our $I18N = {
|
|||
lastUpdated => 1224686319
|
||||
},
|
||||
'answer value description' => {
|
||||
message => q|Enter a value for this answer.|,
|
||||
message => q|Assign a numeric scores to this answers. Used in question scoring and jump expressions.|,
|
||||
context => q|Description of the 'answer value' field, used as hoverhelp in the edit answer dialog.|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
|
|
@ -429,7 +446,35 @@ our $I18N = {
|
|||
message => q|The template to display the main page of the survey.|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'do after timelimit label' => {
|
||||
message => q|Do After Time Limit:|,
|
||||
lastUpdated => 1224686319,
|
||||
context => q|label for the 'do after timelimit' field on the Properties tab of the Survey's edit screen.|,
|
||||
},
|
||||
'do after timelimit hoverHelp' => {
|
||||
message => q|Select what happens after the time limit for finishing the survey has expired.|,
|
||||
lastUpdated => 1231193335,
|
||||
context => q|description of the 'do after timelimit' field on the Properties tab of the Survey's edit
|
||||
screen|,
|
||||
},
|
||||
'exit url label' =>{
|
||||
message => q|Exit URL|,
|
||||
lastUpdated => 0,
|
||||
context => q|Label for the 'exit url' option of the 'do after timelimit' field on the Properties tab of the
|
||||
Survey's edit screen|,
|
||||
},
|
||||
'restart survey label' =>{
|
||||
message => q|Restart Survey|,
|
||||
lastUpdated => 0,
|
||||
context => q|Label for the 'restart survey' option of the 'do after timelimit' field on the Properties tab of the
|
||||
Survey's edit screen|,
|
||||
},
|
||||
'restart message' =>{
|
||||
message => q|The survey was restarted because the time limit for completing the survey was reached.|,
|
||||
lastUpdated => 0,
|
||||
context => q|The message shown to the user taking the survey when the survey is restarted after reaching
|
||||
the time limit for completing the survey. This message is in the 'take survey' template.|,
|
||||
},
|
||||
'Show user their progress' => {
|
||||
message => q|Show user their progress?|,
|
||||
lastUpdated => 0,
|
||||
|
|
@ -489,6 +534,36 @@ our $I18N = {
|
|||
message => q|When the user finishes the surevey, they will be sent to this URL. Leave blank if no special forwarding is required. The gateway setting from the config file will be automatically added to the URL for you.|,
|
||||
lastUpdated => 1233714385,
|
||||
},
|
||||
|
||||
'Overview Report Template' => {
|
||||
message => q|Overview Report Template|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'Overview Report Template help' => {
|
||||
message => q|The template used to display the Overview Report.|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'Grabebook Report Template' => {
|
||||
message => q|Grabebook Report Template|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'Grabebook Report Template help' => {
|
||||
message => q|The template used to display the Gradebook Report|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'Survey Edit Template' => {
|
||||
message => q|Survey Edit Template|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'Survey Edit Template help' => {
|
||||
message => q|The template used to display the Survey Edit screen.|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'Max user responses' => {
|
||||
message => q|Max user responses|,
|
||||
|
|
@ -523,17 +598,6 @@ our $I18N = {
|
|||
lastUpdated => 0
|
||||
},
|
||||
|
||||
'Response Template' => {
|
||||
message => q|Response Template|,
|
||||
context => q|The template for displaying responses to the survey.|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
|
||||
'Response Template help' => {
|
||||
message => q|The template for displaying responses to the survey.|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
|
||||
'Edit Survey Template' => {
|
||||
message => q|Edit Survey Template|,
|
||||
context => q|The template for displaying the screen for editing the survey.|,
|
||||
|
|
@ -552,7 +616,7 @@ our $I18N = {
|
|||
},
|
||||
|
||||
'Take Survey Template help' => {
|
||||
message => q|The template for displaying the screen where a user takes the survey.|,
|
||||
message => q|The template used to control the initial Take Survey screen, from which responses are dynamically loaded into.|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
|
||||
|
|
@ -563,7 +627,7 @@ our $I18N = {
|
|||
},
|
||||
|
||||
'Questions Template help' => {
|
||||
message => q|The template for rendering questions in the survey.|,
|
||||
message => q|The template used to display individual questions, which are dynamically loaded into the Take Survey page.|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
|
||||
|
|
@ -574,7 +638,7 @@ our $I18N = {
|
|||
},
|
||||
|
||||
'Section Edit Template help' => {
|
||||
message => q|The template for adding or editing sections.|,
|
||||
message => q|The template used to display the Section Edit dialog on the Edit Survey page.|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
|
||||
|
|
@ -585,7 +649,7 @@ our $I18N = {
|
|||
},
|
||||
|
||||
'Question Edit Template help' => {
|
||||
message => q|The template for adding or editing questions.|,
|
||||
message => q|The template used to display the Question Edit dialog on the Edit Survey page.|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
|
||||
|
|
@ -596,7 +660,7 @@ our $I18N = {
|
|||
},
|
||||
|
||||
'Answer Edit Template help' => {
|
||||
message => q|The template for adding or editing answers.|,
|
||||
message => q|The template used to display the Answer Edit dialog on the Edit Survey page.|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
|
||||
|
|
@ -859,12 +923,6 @@ directly inside the answer_loop for other types of questions.|,
|
|||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'templateId' => {
|
||||
message => q|The ID of the template to show the Survey.|,
|
||||
context => q|Description of a template variable for a template Help page.|,
|
||||
lastUpdated => 1168639537,
|
||||
},
|
||||
|
||||
'groupToTakeSurvey' => {
|
||||
message => q|The ID of the group that is allowed to take the Survey.|,
|
||||
context => q|Description of a template variable for a template Help page.|,
|
||||
|
|
@ -883,24 +941,6 @@ directly inside the answer_loop for other types of questions.|,
|
|||
lastUpdated => 1168643566,
|
||||
},
|
||||
|
||||
'overviewTemplateId' => {
|
||||
message => q|The ID of the template used to show the overview screen.|,
|
||||
context => q|Description of a template variable for a template Help page.|,
|
||||
lastUpdated => 1168643669,
|
||||
},
|
||||
|
||||
'gradebookTemplateId' => {
|
||||
message => q|The ID of the template used to show the gradebook screen.|,
|
||||
context => q|Description of a template variable for a template Help page.|,
|
||||
lastUpdated => 1168643669,
|
||||
},
|
||||
|
||||
'responseTemplateId' => {
|
||||
message => q|The ID of the template used to show the Survey Response screen.|,
|
||||
context => q|Description of a template variable for a template Help page.|,
|
||||
lastUpdated => 1168643669,
|
||||
},
|
||||
|
||||
'survey questions template title' => {
|
||||
message => q|Survey Questions Template|,
|
||||
context => q|The title of a template Help page.|,
|
||||
|
|
@ -1227,18 +1267,6 @@ section/answer.|,
|
|||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'min' => {
|
||||
message => q|The min value of this answer for slider type questions.|,
|
||||
context => q|Description of a template variable for a template Help page.|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'max' => {
|
||||
message => q|The max value of this answer for slider type questions..|,
|
||||
context => q|Description of a template variable for a template Help page.|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'step' => {
|
||||
message => q|The step value of this answer for slider type questions..|,
|
||||
context => q|Description of a template variable for a template Help page.|,
|
||||
|
|
@ -1252,13 +1280,13 @@ section/answer.|,
|
|||
},
|
||||
|
||||
'textCols' => {
|
||||
message => q|The number of columns for textarea answers.|,
|
||||
message => q|The number of columns for TextArea questions.|,
|
||||
context => q|Description of a template variable for a template Help page.|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'textRows' => {
|
||||
message => q|The number of rows for textarea answers.|,
|
||||
message => q|The number of rows for TextArea questions.|,
|
||||
context => q|Description of a template variable for a template Help page.|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use strict;
|
|||
our $I18N = {
|
||||
|
||||
'from user preface' => {
|
||||
message => q|You were sent a message from |,
|
||||
message => q|You were sent a message from %s|,
|
||||
lastUpdated => 0
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -0,0 +1,67 @@
|
|||
package WebGUI::i18n::English::Workflow_Activity_ExpireIncompleteSurveyResponses;
|
||||
use strict;
|
||||
|
||||
our $I18N = {
|
||||
'name' => {
|
||||
message => q|ExpireIncompleteSurveyResponses|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
'Delete expired survey responses' => {
|
||||
message => q|Delete expired survey responses|,
|
||||
context => q|the hover help for the delete responses field|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
'delete expired' => {
|
||||
message => q|When ran, every survey response which is expired will be completely removed from the database.|,
|
||||
context => q|the hover help for the delete responses field|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
'Email users that responses were deleted' => {
|
||||
message => q|Email users that responses were deleted|,
|
||||
context => q|the hover help for the email users field|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
'email users' => {
|
||||
message => q|When a survey response is deleted, should the user be informed of this via email?|,
|
||||
context => q|the hover help for the email users field|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
'email template' => {
|
||||
message => q|When an email is sent updating the user that their response has been deleted, this is the text that is sent to them.|,
|
||||
context => q|the hover help for the email template field|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
'from' => {
|
||||
message => q|Email from field|,
|
||||
context => q||,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
'from mouse over' => {
|
||||
message => q|This is the from field that will show up in the sent email.|,
|
||||
context => q||,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
'subject' => {
|
||||
message => q|Email subject field|,
|
||||
context => q||,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
'subject mouse over' => {
|
||||
message => q|This is the subject field that will show up in the sent email.|,
|
||||
context => q||,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
'Email template sent to user' => {
|
||||
message => q|The template for the email|,
|
||||
context => q||,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
'email template' => {
|
||||
message => q|This is the email template that will be sent to the user|,
|
||||
context => q||,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
@ -120,6 +120,7 @@ checkModule("List::MoreUtils", "0.22" );
|
|||
checkModule("File::Path", "2.04" );
|
||||
checkModule("Module::Find", "0.06" );
|
||||
checkModule("Class::C3", "0.19" );
|
||||
checkModule("Params::Validate", "0.81" );
|
||||
|
||||
failAndExit("Required modules are missing, running no more checks.") if $missingModule;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ my $session = WebGUI::Test->session;
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
my $tests = 1;
|
||||
my $tests = 10;
|
||||
plan tests => $tests + 1;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
@ -37,6 +37,56 @@ $import_node = WebGUI::Asset->getImportNode($session);
|
|||
$survey = $import_node->addChild( { className => 'WebGUI::Asset::Wobject::Survey', } );
|
||||
isa_ok($survey, 'WebGUI::Asset::Wobject::Survey');
|
||||
|
||||
# Load bare-bones survey, containing a single section (S0)
|
||||
$survey->surveyJSON_update([0], { variable => 'S0' });
|
||||
|
||||
# Add 2 questions to S0
|
||||
$survey->surveyJSON_newObject([0]); # S0Q0
|
||||
$survey->surveyJSON_update([0,0], { variable => 'S0Q0' });
|
||||
$survey->surveyJSON_newObject([0]); # S0Q1
|
||||
$survey->surveyJSON_update([0,1], { variable => 'S0Q1' });
|
||||
|
||||
# Add a new section (S1)
|
||||
$survey->surveyJSON_newObject([]); # S1
|
||||
$survey->surveyJSON_update([1], { variable => 'S1' });
|
||||
|
||||
# Add 2 questions to S1
|
||||
$survey->surveyJSON_newObject([1]); # S1Q0
|
||||
$survey->surveyJSON_update([1,0], { variable => 'S1Q0' });
|
||||
$survey->surveyJSON_newObject([1]); # S1Q1
|
||||
$survey->surveyJSON_update([1,1], { variable => 'S1Q1' });
|
||||
|
||||
# Now start a response as admin user
|
||||
$session->user( { userId =>3 } );
|
||||
$survey->responseIdCookies(0);
|
||||
|
||||
#for my $address (@{ $survey->responseJSON->surveyOrder }) {
|
||||
# diag (Dumper $address);
|
||||
#}
|
||||
|
||||
# www_jumpTo
|
||||
{
|
||||
# Check a simple www_jumpTo request
|
||||
WebGUI::Test->getPage( $survey, 'www_jumpTo', { formParams => {id => '0'} } );
|
||||
is( $session->http->getStatus, '201', 'Page request ok' ); # why is "201 - created" status used??
|
||||
is($survey->responseJSON->nextResponse, 0, 'S0 is the first response');
|
||||
|
||||
tie my %expectedSurveyOrder, 'Tie::IxHash';
|
||||
%expectedSurveyOrder = (
|
||||
'undefined' => 0,
|
||||
'0' => 0,
|
||||
'0-0' => 0,
|
||||
'0-1' => 1,
|
||||
'1' => 2,
|
||||
'1-0' => 2,
|
||||
'1-1' => 3,
|
||||
);
|
||||
while (my ($id, $index) = each %expectedSurveyOrder) {
|
||||
WebGUI::Test->getPage( $survey, 'www_jumpTo', { formParams => {id => $id} } );
|
||||
is($survey->responseJSON->nextResponse, $index, "jumpTo($id) sets nextResponse to $index");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ use lib "$FindBin::Bin/../../../lib";
|
|||
use Test::More;
|
||||
use Test::Deep;
|
||||
use Test::MockObject::Extends;
|
||||
use Test::Exception;
|
||||
use Data::Dumper;
|
||||
use WebGUI::Test; # Must use this before any other WebGUI modules
|
||||
use WebGUI::Session;
|
||||
|
|
@ -20,7 +21,7 @@ my $session = WebGUI::Test->session;
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
my $tests = 52;
|
||||
my $tests = 79;
|
||||
plan tests => $tests + 1;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
@ -40,17 +41,16 @@ skip $tests, "Unable to load ResponseJSON" unless $usedOk;
|
|||
####################################################
|
||||
|
||||
my $newTime = time();
|
||||
$responseJSON = WebGUI::Asset::Wobject::Survey::ResponseJSON->new('{}', $session->log);
|
||||
$responseJSON = WebGUI::Asset::Wobject::Survey::ResponseJSON->new(buildSurveyJSON($session), '{}');
|
||||
isa_ok($responseJSON , 'WebGUI::Asset::Wobject::Survey::ResponseJSON');
|
||||
|
||||
is($responseJSON->lastResponse(), -1, 'new: default lastResponse is -1');
|
||||
is($responseJSON->{questionsAnswered}, 0, 'new: questionsAnswered is 0 by default');
|
||||
cmp_ok((abs$responseJSON->{startTime} - $newTime), '<=', 2, 'new: by default startTime set to time');
|
||||
is($responseJSON->questionsAnswered, 0, 'new: questionsAnswered is 0 by default');
|
||||
cmp_ok((abs$responseJSON->startTime - $newTime), '<=', 2, 'new: by default startTime set to time');
|
||||
is_deeply( $responseJSON->responses, {}, 'new: by default, responses is an empty hashref');
|
||||
is_deeply( $responseJSON->surveyOrder, [], 'new: by default, responses is an empty arrayref');
|
||||
|
||||
my $now = time();
|
||||
my $rJSON = WebGUI::Asset::Wobject::Survey::ResponseJSON->new(qq!{ "startTime": $now }!, $session->log);
|
||||
my $rJSON = WebGUI::Asset::Wobject::Survey::ResponseJSON->new(buildSurveyJSON($session), qq!{ "startTime": $now }!);
|
||||
cmp_ok(abs($rJSON->startTime() - $now), '<=', 2, 'new: startTime set using JSON');
|
||||
|
||||
####################################################
|
||||
|
|
@ -81,13 +81,13 @@ ok( ! $rJSON->hasTimedOut(4*60), 'hasTimedOut, limit check');
|
|||
|
||||
####################################################
|
||||
#
|
||||
# createSurveyOrder
|
||||
# initSurveyOrder
|
||||
#
|
||||
####################################################
|
||||
|
||||
$rJSON = WebGUI::Asset::Wobject::Survey::ResponseJSON->new(q!{}!, $session->log, buildSurveyJSON($session));
|
||||
$rJSON = WebGUI::Asset::Wobject::Survey::ResponseJSON->new(buildSurveyJSON($session), q!{}!);
|
||||
|
||||
$rJSON->createSurveyOrder();
|
||||
#$rJSON->initSurveyOrder();
|
||||
cmp_deeply(
|
||||
$rJSON->surveyOrder,
|
||||
[
|
||||
|
|
@ -101,7 +101,7 @@ cmp_deeply(
|
|||
[ 3, 1, [0, 1, 2, 3, 4, 5, 6] ],
|
||||
[ 3, 2, [0] ],
|
||||
],
|
||||
'createSurveyOrder, enumerated all sections, questions and answers'
|
||||
'initSurveyOrder, enumerated all sections, questions and answers'
|
||||
);
|
||||
|
||||
####################################################
|
||||
|
|
@ -118,38 +118,35 @@ cmp_deeply(
|
|||
|
||||
####################################################
|
||||
#
|
||||
# createSurveyOrder, part 2
|
||||
# initSurveyOrder, part 2
|
||||
#
|
||||
####################################################
|
||||
|
||||
{
|
||||
no strict "refs";
|
||||
no warnings;
|
||||
my $rJSON = WebGUI::Asset::Wobject::Survey::ResponseJSON->new(q!{}!, $session->log, buildSurveyJSON($session));
|
||||
$rJSON->survey->section([0])->{randomizeQuestions} = 0;
|
||||
my $shuffleName = "WebGUI::Asset::Wobject::Survey::ResponseJSON::shuffle";
|
||||
my $shuffleCalled = 0;
|
||||
my $shuffleRef = \&$shuffleName;
|
||||
*$shuffleName = sub {
|
||||
$shuffleCalled = 1;
|
||||
goto &$shuffleRef;
|
||||
};
|
||||
$rJSON->createSurveyOrder();
|
||||
is($shuffleCalled, 0, 'createSurveyOrder did not call shuffle on a section');
|
||||
my $rJSON = WebGUI::Asset::Wobject::Survey::ResponseJSON->new(buildSurveyJSON($session), q!{}!);
|
||||
|
||||
$rJSON->survey->section([0])->{randomizeQuestions} = 0;
|
||||
$rJSON->initSurveyOrder();
|
||||
my @question_order = map {$_->[1]} grep {$_->[0] == 0} @{$rJSON->surveyOrder};
|
||||
cmp_deeply(\@question_order, [0,1,2], 'initSurveyOrder did not shuffle questions');
|
||||
|
||||
$shuffleCalled = 0;
|
||||
$rJSON->survey->section([0])->{randomizeQuestions} = 1;
|
||||
$rJSON->createSurveyOrder();
|
||||
is($shuffleCalled, 1, 'createSurveyOrder called shuffle on a section');
|
||||
srand(42); # Make shuffle predictable
|
||||
$rJSON->initSurveyOrder();
|
||||
@question_order = map {$_->[1]} grep {$_->[0] == 0} @{$rJSON->surveyOrder};
|
||||
cmp_deeply(\@question_order, [2,0,1], 'initSurveyOrder shuffled questions in first section');
|
||||
|
||||
$shuffleCalled = 0;
|
||||
$rJSON->survey->section([0])->{randomizeQuestions} = 0;
|
||||
$rJSON->survey->question([0,0])->{randomizeAnswers} = 1;
|
||||
$rJSON->createSurveyOrder();
|
||||
is($shuffleCalled, 1, 'createSurveyOrder called shuffle on a question');
|
||||
|
||||
##Restore the subroutine to the original
|
||||
*$shuffleName = &$shuffleRef;
|
||||
$rJSON->survey->question([0,0])->{randomizeAnswers} = 0;
|
||||
$rJSON->initSurveyOrder();
|
||||
my @answer_order = map {@{$_->[2]}} grep {$_->[0] == 3 && $_->[1] == 1} @{$rJSON->surveyOrder};
|
||||
cmp_deeply(\@answer_order, [0,1,2,3,4,5,6], 'initSurveyOrder did not shuffle answers');
|
||||
|
||||
$rJSON->survey->question([3,1])->{randomizeAnswers} = 1;
|
||||
srand(42); # Make shuffle predictable
|
||||
$rJSON->initSurveyOrder();
|
||||
@answer_order = map {@{$_->[2]}} grep {$_->[0] == 3 && $_->[1] == 1} @{$rJSON->surveyOrder};
|
||||
cmp_deeply(\@answer_order, [1,3,4,5,6,0,2], 'initSurveyOrder shuffled answers');
|
||||
}
|
||||
|
||||
####################################################
|
||||
|
|
@ -169,51 +166,51 @@ ok( $rJSON->surveyEnd(), 'surveyEnd, with 9 elements, 20 >= end of survey');
|
|||
|
||||
####################################################
|
||||
#
|
||||
# nextSectionId, nextSection, currentSection
|
||||
# nextResponseSectionIndex, nextResponseSection, lastResponseSectionIndex
|
||||
#
|
||||
####################################################
|
||||
|
||||
$rJSON->lastResponse(0);
|
||||
is($rJSON->nextSectionId(), 0, 'nextSectionId, lastResponse=0, nextSectionId=0');
|
||||
is($rJSON->nextResponseSectionIndex, 0, 'nextResponseSectionIndex, lastResponse=0, nextResponseSectionIndex=0');
|
||||
cmp_deeply(
|
||||
$rJSON->nextSection,
|
||||
$rJSON->nextResponseSection,
|
||||
$rJSON->survey->section([0]),
|
||||
'lastResponse=0, nextSection = section 0'
|
||||
'lastResponse=0, nextResponseSection = section 0'
|
||||
);
|
||||
cmp_deeply(
|
||||
$rJSON->currentSection,
|
||||
$rJSON->survey->section([0]),
|
||||
'lastResponse=0, currentSection = section 0'
|
||||
is(
|
||||
$rJSON->lastResponseSectionIndex,
|
||||
0,
|
||||
'lastResponse=0, lastResponseSectionIndex = 0'
|
||||
);
|
||||
|
||||
$rJSON->lastResponse(2);
|
||||
is($rJSON->nextSectionId(), 1, 'nextSectionId, lastResponse=2, nextSectionId=1');
|
||||
is($rJSON->nextResponseSectionIndex(), 1, 'nextResponseSectionIndex, lastResponse=2, nextResponseSectionIndex=1');
|
||||
cmp_deeply(
|
||||
$rJSON->nextSection,
|
||||
$rJSON->nextResponseSection,
|
||||
$rJSON->survey->section([1]),
|
||||
'lastResponse=2, nextSection = section 1'
|
||||
'lastResponse=2, nextResponseSection = section 1'
|
||||
);
|
||||
cmp_deeply(
|
||||
$rJSON->currentSection,
|
||||
$rJSON->survey->section([0]),
|
||||
'lastResponse=2, currentSection = section 0'
|
||||
is(
|
||||
$rJSON->lastResponseSectionIndex,
|
||||
0,
|
||||
'lastResponse=2, lastResponseSectionIndex = 0'
|
||||
);
|
||||
|
||||
$rJSON->lastResponse(6);
|
||||
is($rJSON->nextSectionId(), 3, 'nextSectionId, lastResponse=6, nextSectionId=3');
|
||||
is($rJSON->nextResponseSectionIndex(), 3, 'nextResponseSectionIndex, lastResponse=6, nextResponseSectionIndex=3');
|
||||
cmp_deeply(
|
||||
$rJSON->nextSection,
|
||||
$rJSON->nextResponseSection,
|
||||
$rJSON->survey->section([3]),
|
||||
'lastResponse=0, nextSection = section 3'
|
||||
'lastResponse=0, nextResponseSection = section 3'
|
||||
);
|
||||
cmp_deeply(
|
||||
$rJSON->currentSection,
|
||||
$rJSON->survey->section([3]),
|
||||
'lastResponse=6, currentSection = section 3'
|
||||
$rJSON->lastResponseSectionIndex,
|
||||
3,
|
||||
'lastResponse=6, lastResponseSectionIndex = 3'
|
||||
);
|
||||
|
||||
$rJSON->lastResponse(20);
|
||||
is($rJSON->nextSectionId(), undef, 'nextSectionId, lastResponse > surveyEnd, nextSectionId=undef');
|
||||
is($rJSON->nextResponseSectionIndex(), undef, 'nextResponseSectionIndex, lastResponse > surveyEnd, nextResponseSectionIndex=undef');
|
||||
|
||||
####################################################
|
||||
#
|
||||
|
|
@ -223,14 +220,14 @@ is($rJSON->nextSectionId(), undef, 'nextSectionId, lastResponse > surveyEnd, nex
|
|||
|
||||
$rJSON->lastResponse(20);
|
||||
ok($rJSON->surveyEnd, 'nextQuestions: lastResponse indicates end of survey');
|
||||
is_deeply($rJSON->nextQuestions, [], 'nextQuestions returns an empty array ref if there are no questions available');
|
||||
is_deeply([$rJSON->nextQuestions], [], 'nextQuestions returns an empty array if there are no questions available');
|
||||
$rJSON->survey->section([0])->{questionsPerPage} = 2;
|
||||
$rJSON->survey->section([1])->{questionsPerPage} = 2;
|
||||
$rJSON->survey->section([2])->{questionsPerPage} = 2;
|
||||
$rJSON->survey->section([3])->{questionsPerPage} = 2;
|
||||
$rJSON->lastResponse(-1);
|
||||
cmp_deeply(
|
||||
$rJSON->nextQuestions(),
|
||||
[$rJSON->nextQuestions],
|
||||
[
|
||||
superhashof({
|
||||
sid => 0,
|
||||
|
|
@ -262,7 +259,7 @@ cmp_deeply(
|
|||
|
||||
$rJSON->lastResponse(1);
|
||||
cmp_deeply(
|
||||
$rJSON->nextQuestions(),
|
||||
[$rJSON->nextQuestions],
|
||||
[
|
||||
superhashof({
|
||||
sid => 0,
|
||||
|
|
@ -286,9 +283,9 @@ cmp_deeply(
|
|||
|
||||
$rJSON->lastResponse(4);
|
||||
cmp_deeply(
|
||||
$rJSON->nextQuestions(),
|
||||
undef,
|
||||
'nextQuestions: returns undef if the next section is empty'
|
||||
[$rJSON->nextQuestions],
|
||||
[],
|
||||
'nextQuestions: returns an empty array if the next section is empty'
|
||||
);
|
||||
|
||||
####################################################
|
||||
|
|
@ -310,15 +307,90 @@ $rJSON->survey->question([3,1])->{variable} = 'goto 3-0'; ##Intentional duplica
|
|||
$rJSON->survey->question([3,2])->{variable} = 'goto 3-2';
|
||||
|
||||
$rJSON->lastResponse(0);
|
||||
$rJSON->goto('goto 80');
|
||||
$rJSON->processGoto('goto 80');
|
||||
is($rJSON->lastResponse(), 0, 'goto: no change in lastResponse if the variable cannot be found');
|
||||
$rJSON->goto('goto 1');
|
||||
$rJSON->processGoto('goto 1');
|
||||
is($rJSON->lastResponse(), 2, 'goto: works on existing section');
|
||||
$rJSON->goto('goto 0-1');
|
||||
$rJSON->processGoto('goto 0-1');
|
||||
is($rJSON->lastResponse(), 0, 'goto: works on existing question');
|
||||
$rJSON->goto('goto 3-0');
|
||||
$rJSON->processGoto('goto 3-0');
|
||||
is($rJSON->lastResponse(), 5, 'goto: finds first if there are duplicates');
|
||||
|
||||
####################################################
|
||||
#
|
||||
# processGotoExpression
|
||||
#
|
||||
####################################################
|
||||
throws_ok { $rJSON->parseGotoExpression() } 'WebGUI::Error::InvalidParam', 'processGotoExpression takes exception to empty arguments';
|
||||
is($rJSON->parseGotoExpression(q{}),
|
||||
undef, '.. and undef with empty expression');
|
||||
is($rJSON->parseGotoExpression('blah-dee-blah-blah'),
|
||||
undef, '.. and undef with duff expression');
|
||||
is($rJSON->parseGotoExpression(':'),
|
||||
undef, '.. and undef with missing target');
|
||||
is($rJSON->parseGotoExpression('t1:'),
|
||||
undef, '.. and undef with missing expression');
|
||||
cmp_deeply($rJSON->parseGotoExpression('t1: 1'),
|
||||
{ target => 't1', expression => '1'}, 'works for simple numeric expression');
|
||||
cmp_deeply($rJSON->parseGotoExpression('t1: 1 - 23 + 456 * (78 / 9.0)'),
|
||||
{ target => 't1', expression => '1 - 23 + 456 * (78 / 9.0)'}, 'works for expression using all algebraic tokens');
|
||||
is($rJSON->parseGotoExpression('t1: 1 + &'), undef, '.. but disallows expression containing non-whitelisted token');
|
||||
cmp_deeply($rJSON->parseGotoExpression('t1: 1 = 3'),
|
||||
{ target => 't1', expression => '1 == 3'}, 'converts single = to ==');
|
||||
cmp_deeply($rJSON->parseGotoExpression('t1: 1 != 3 <= 4 >= 5'),
|
||||
{ target => 't1', expression => '1 != 3 <= 4 >= 5'}, q{..but doesn't mess with other ops containing =});
|
||||
cmp_deeply($rJSON->parseGotoExpression('t1: q1 + q2 * q3 - 4', { q1 => 11, q2 => 22, q3 => 33}),
|
||||
{ target => 't1', expression => '11 + 22 * 33 - 4'}, 'substitues q for value');
|
||||
cmp_deeply($rJSON->parseGotoExpression('t1: a silly var name * 10 + another var name', { 'a silly var name' => 345, 'another var name' => 456}),
|
||||
{ target => 't1', expression => '345 * 10 + 456'}, '..it even works for vars with spaces in their names');
|
||||
is($rJSON->parseGotoExpression('t1: qX + 3', { q1 => '7'}),
|
||||
undef, q{..but doesn't like invalid var names});
|
||||
|
||||
####################################################
|
||||
#
|
||||
# gotoExpression
|
||||
#
|
||||
####################################################
|
||||
|
||||
$rJSON->survey->section([0])->{variable} = 's0';
|
||||
$rJSON->survey->section([2])->{variable} = 's2';
|
||||
$rJSON->survey->question([1,0])->{variable} = 's1q0';
|
||||
$rJSON->survey->answer([1,0,0])->{value} = 3;
|
||||
|
||||
$rJSON->lastResponse(2);
|
||||
$rJSON->recordResponses({
|
||||
'1-0comment' => 'Section 1, question 0 comment',
|
||||
'1-0-0' => 'First answer',
|
||||
'1-0-0comment' => 'Section 1, question 0, answer 0 comment',
|
||||
});
|
||||
is($rJSON->processGotoExpression('blah-dee-blah-blah'), undef, 'invalid gotoExpression is false');
|
||||
ok($rJSON->processGotoExpression('s0: s1q0 = 3'), '3 == 3 is true');
|
||||
ok(!$rJSON->processGotoExpression('s0: s1q0 = 4'), '3 == 4 is false');
|
||||
ok($rJSON->processGotoExpression('s0: s1q0 != 2'), '3 != 2 is true');
|
||||
ok(!$rJSON->processGotoExpression('s0: s1q0 != 3'), '3 != 3 is false');
|
||||
ok($rJSON->processGotoExpression('s0: s1q0 > 2'), '3 > 2 is true');
|
||||
ok($rJSON->processGotoExpression('s0: s1q0 < 4'), '3 < 2 is true');
|
||||
ok(!$rJSON->processGotoExpression('s0: s1q0 >= 4'), '3 >= 4 is false');
|
||||
ok(!$rJSON->processGotoExpression('s0: s1q0 <= 2'), '3 >= 4 is false');
|
||||
|
||||
cmp_deeply($rJSON->processGotoExpression(<<"END_EXPRESSION"), {target => 's2', expression => '3 == 3'}, 'first true expression wins');
|
||||
s0: s1q0 <= 2
|
||||
s2: s1q0 = 3
|
||||
END_EXPRESSION
|
||||
|
||||
ok(!$rJSON->processGotoExpression(<<"END_EXPRESSION"), 'but multiple false expressions still false');
|
||||
s0: s1q0 <= 2
|
||||
s2: s1q0 = 345
|
||||
END_EXPRESSION
|
||||
|
||||
$rJSON->processGotoExpression('s0: s1q0 = 3');
|
||||
is($rJSON->lastResponse(), -1, '.. lastResponse changed to -1 due to processGoto(s0)');
|
||||
$rJSON->processGotoExpression('s2: s1q0 = 3');
|
||||
is($rJSON->lastResponse(), 4, '.. lastResponse changed to 4 due to processGoto(s2)');
|
||||
|
||||
$rJSON->responses({});
|
||||
$rJSON->questionsAnswered(-1 * $rJSON->questionsAnswered);
|
||||
|
||||
####################################################
|
||||
#
|
||||
# recordResponses
|
||||
|
|
@ -328,7 +400,7 @@ is($rJSON->lastResponse(), 5, 'goto: finds first if there are duplicates');
|
|||
$rJSON->lastResponse(4);
|
||||
my $terminals;
|
||||
cmp_deeply(
|
||||
$rJSON->recordResponses($session, {}),
|
||||
$rJSON->recordResponses({}),
|
||||
[ 0, undef ],
|
||||
'recordResponses, if section has no questions, returns terminal info in the section. With no terminal info, returns [0, undef]',
|
||||
);
|
||||
|
|
@ -339,7 +411,7 @@ $rJSON->survey->section([2])->{terminalUrl} = '/terminal';
|
|||
|
||||
$rJSON->lastResponse(4);
|
||||
cmp_deeply(
|
||||
$rJSON->recordResponses($session, {}),
|
||||
$rJSON->recordResponses({}),
|
||||
[ 1, '/terminal' ],
|
||||
'recordResponses, if section has no questions, returns terminal info in the section.',
|
||||
);
|
||||
|
|
@ -350,7 +422,7 @@ $rJSON->survey->question([1,0])->{terminalUrl} = 'question 1-0 terminal';
|
|||
|
||||
$rJSON->lastResponse(2);
|
||||
cmp_deeply(
|
||||
$rJSON->recordResponses($session, {
|
||||
$rJSON->recordResponses({
|
||||
'1-0comment' => 'Section 1, question 0 comment',
|
||||
'1-0-0' => 'First answer',
|
||||
'1-0-0comment' => 'Section 1, question 0, answer 0 comment',
|
||||
|
|
@ -358,6 +430,7 @@ cmp_deeply(
|
|||
[ 1, 'question 1-0 terminal' ],
|
||||
'recordResponses: question terminal overrides section terminal',
|
||||
);
|
||||
|
||||
is($rJSON->lastResponse(), 4, 'lastResponse advanced to next page of questions');
|
||||
is($rJSON->questionsAnswered, 1, 'questionsAnswered=1, answered one question');
|
||||
|
||||
|
|
@ -370,7 +443,7 @@ cmp_deeply(
|
|||
'1-0-0' => {
|
||||
comment => 'Section 1, question 0, answer 0 comment',
|
||||
'time' => num(time(), 3),
|
||||
value => 1,
|
||||
value => 1, # 'recordedAnswer' value used because question is multi-choice
|
||||
},
|
||||
'1-1' => {
|
||||
comment => undef,
|
||||
|
|
@ -379,14 +452,44 @@ cmp_deeply(
|
|||
'recordResponses: recorded responses correctly, two questions, one answer, comments, values and time'
|
||||
);
|
||||
|
||||
|
||||
# Repeat with non multi-choice question, to check that submitted answer value is used
|
||||
# instead of recordedValue
|
||||
$rJSON->survey->question([1,0])->{questionType} = 'Text';
|
||||
$rJSON->lastResponse(2);
|
||||
$rJSON->questionsAnswered(-1 * $rJSON->questionsAnswered);
|
||||
$rJSON->recordResponses({
|
||||
'1-0comment' => 'Section 1, question 0 comment',
|
||||
'1-0-0' => 'First answer',
|
||||
'1-0-0comment' => 'Section 1, question 0, answer 0 comment',
|
||||
});
|
||||
cmp_deeply(
|
||||
$rJSON->responses,
|
||||
{
|
||||
'1-0' => {
|
||||
comment => 'Section 1, question 0 comment',
|
||||
},
|
||||
'1-0-0' => {
|
||||
comment => 'Section 1, question 0, answer 0 comment',
|
||||
'time' => num(time(), 3),
|
||||
value => 'First answer', # submitted answer value used this time because non-mc
|
||||
},
|
||||
'1-1' => {
|
||||
comment => undef,
|
||||
}
|
||||
},
|
||||
'recordResponses: recorded responses correctly, two questions, one answer, comments, values and time'
|
||||
);
|
||||
$rJSON->survey->question([1,0])->{questionType} = 'Multiple Choice'; # revert change
|
||||
|
||||
$rJSON->survey->question([1,0,0])->{terminal} = 1;
|
||||
$rJSON->survey->question([1,0,0])->{terminalUrl} = 'answer 1-0-0 terminal';
|
||||
$rJSON->{responses} = {};
|
||||
$rJSON->responses({});
|
||||
$rJSON->lastResponse(2);
|
||||
$rJSON->questionsAnswered(-1 * $rJSON->questionsAnswered);
|
||||
|
||||
cmp_deeply(
|
||||
$rJSON->recordResponses($session, {
|
||||
$rJSON->recordResponses({
|
||||
'1-0comment' => 'Section 1, question 0 comment',
|
||||
'1-0-0' => "\t\t\t\n\n\n\t\t\t", #SOS in whitespace
|
||||
'1-0-0comment' => 'Section 1, question 0, answer 0 comment',
|
||||
|
|
@ -408,6 +511,9 @@ cmp_deeply(
|
|||
'recordResponses: if the answer is all whitespace, it is skipped over'
|
||||
);
|
||||
is($rJSON->questionsAnswered, 0, 'question was all whitespace, not answered');
|
||||
#delete $rJSON->{_session};
|
||||
#delete $rJSON->survey->{_session};
|
||||
#diag(Dumper($rJSON));
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -419,7 +525,7 @@ is($rJSON->questionsAnswered, 0, 'question was all whitespace, not answered');
|
|||
|
||||
sub buildSurveyJSON {
|
||||
my $session = shift;
|
||||
my $sjson = WebGUI::Asset::Wobject::Survey::SurveyJSON->new(undef, $session->log);
|
||||
my $sjson = WebGUI::Asset::Wobject::Survey::SurveyJSON->new($session);
|
||||
##Build 4 sections. Remembering that one is created by default when you make an empty SurveyJSON object
|
||||
$sjson->newObject([]);
|
||||
$sjson->newObject([]);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ my $session = WebGUI::Test->session;
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
my $tests = 96;
|
||||
my $tests = 132;
|
||||
plan tests => $tests + 1 + 3;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
@ -126,10 +126,10 @@ skip $tests, "Unable to load SurveyJSON" unless $usedOk;
|
|||
#
|
||||
####################################################
|
||||
|
||||
$surveyJSON = WebGUI::Asset::Wobject::Survey::SurveyJSON->new('{}', $session->log);
|
||||
$surveyJSON = WebGUI::Asset::Wobject::Survey::SurveyJSON->new($session, '{}');
|
||||
isa_ok($surveyJSON, 'WebGUI::Asset::Wobject::Survey::SurveyJSON');
|
||||
|
||||
my $sJSON2 = WebGUI::Asset::Wobject::Survey::SurveyJSON->new(undef, $session->log);
|
||||
my $sJSON2 = WebGUI::Asset::Wobject::Survey::SurveyJSON->new($session);
|
||||
isa_ok($sJSON2, 'WebGUI::Asset::Wobject::Survey::SurveyJSON', 'even with absolutely no JSON');
|
||||
undef $sJSON2;
|
||||
|
||||
|
|
@ -173,9 +173,8 @@ cmp_deeply(
|
|||
'new: empty JSON in constructor causes 1 new, default section to be created',
|
||||
);
|
||||
|
||||
$surveyJSON = WebGUI::Asset::Wobject::Survey::SurveyJSON->new(
|
||||
$surveyJSON = WebGUI::Asset::Wobject::Survey::SurveyJSON->new($session,
|
||||
'{ "sections" : [], "survey" : {} }',
|
||||
$session->log,
|
||||
);
|
||||
|
||||
cmp_deeply(
|
||||
|
|
@ -188,16 +187,14 @@ cmp_deeply(
|
|||
|
||||
lives_ok
|
||||
{
|
||||
my $foo = WebGUI::Asset::Wobject::Survey::SurveyJSON->new(
|
||||
qq!{ "survey" : "on 16\x{201d} hand-crocheted Cord" }!,
|
||||
$session->log
|
||||
my $foo = WebGUI::Asset::Wobject::Survey::SurveyJSON->new($session,
|
||||
encode_json({survey => "on 16\x{201d}" }),
|
||||
);
|
||||
}
|
||||
'new handles wide characters';
|
||||
|
||||
$sJSON2 = WebGUI::Asset::Wobject::Survey::SurveyJSON->new(
|
||||
$sJSON2 = WebGUI::Asset::Wobject::Survey::SurveyJSON->new($session,
|
||||
'{ "sections" : [ { "type" : "section" } ], "survey" : {} }',
|
||||
$session->log,
|
||||
);
|
||||
|
||||
cmp_deeply(
|
||||
|
|
@ -276,7 +273,7 @@ cmp_deeply(
|
|||
#
|
||||
####################################################
|
||||
|
||||
$surveyJSON = WebGUI::Asset::Wobject::Survey::SurveyJSON->new('{}', $session->log);
|
||||
$surveyJSON = WebGUI::Asset::Wobject::Survey::SurveyJSON->new($session, '{}');
|
||||
{
|
||||
my $section = $surveyJSON->section([0]);
|
||||
$section->{title} = 'Section 0';
|
||||
|
|
@ -2003,18 +2000,81 @@ cmp_deeply(
|
|||
'updateQuestionAnswers: Dual Slider - Range'
|
||||
);
|
||||
|
||||
####################################################
|
||||
#
|
||||
# totalSections
|
||||
#
|
||||
####################################################
|
||||
{
|
||||
my $s = WebGUI::Asset::Wobject::Survey::SurveyJSON->new($session, '{}');
|
||||
is($s->totalSections, 1, 'a');
|
||||
is($s->totalQuestions, 0, 'a');
|
||||
is($s->totalAnswers, 0, 'a');
|
||||
|
||||
# Add a new section
|
||||
my $address = $s->newObject([]);
|
||||
is($s->totalSections, 2, 'Now there are 2 sections');
|
||||
is($s->totalQuestions, 0, '..but still no questions');
|
||||
is($s->totalAnswers, 0, '..and no answers');
|
||||
|
||||
# Add a question to first section
|
||||
$address = $s->newObject([0]);
|
||||
is($s->totalSections, 2, 'Still 2 sections');
|
||||
is($s->totalQuestions, 1, '..and now 1 question');
|
||||
is($s->totalQuestions([0]), 1, '..in the intended section');
|
||||
is($s->totalAnswers, 0, '..but still no answers');
|
||||
|
||||
# Add a question to second section
|
||||
$address = $s->newObject([1]);
|
||||
is($s->totalSections, 2, 'Still 2 sections');
|
||||
is($s->totalQuestions, 2, '..and now 2 questions overall');
|
||||
is($s->totalQuestions([0]), 1, '..one in the first section');
|
||||
is($s->totalQuestions([1]), 1, '..and one in the second section');
|
||||
is($s->totalAnswers, 0, '..but still no answers');
|
||||
|
||||
# Add another question to second section
|
||||
$address = $s->newObject([1]);
|
||||
is($s->totalSections, 2, 'Still 2 sections');
|
||||
is($s->totalQuestions, 3, '..and now 3 questions overall');
|
||||
is($s->totalQuestions([0]), 1, '..one in the first section');
|
||||
is($s->totalQuestions([1]), 2, '..and two in the second section');
|
||||
is($s->totalAnswers, 0, '..but still no answers');
|
||||
|
||||
# Add an answer to second section, first question
|
||||
$address = $s->newObject([1,0]);
|
||||
is($s->totalSections, 2, 'Still 2 sections');
|
||||
is($s->totalQuestions, 3, '..and 3 questions');
|
||||
is($s->totalAnswers, 1, '..and now 1 answer overall');
|
||||
is($s->totalAnswers([0,0]), 0, '..0 in first question');
|
||||
is($s->totalAnswers([1,0]), 1, '..1 in second question');
|
||||
is($s->totalAnswers([1,1]), 0, '..0 in third question');
|
||||
|
||||
# Add an answer to second section, second question
|
||||
$address = $s->newObject([1,1]);
|
||||
is($s->totalSections, 2, 'Still 2 sections');
|
||||
is($s->totalQuestions, 3, '..and 3 questions');
|
||||
is($s->totalAnswers, 2, '..and now 2 answer overall');
|
||||
is($s->totalAnswers([0,0]), 0, '..0 in first question');
|
||||
is($s->totalAnswers([1,0]), 1, '..1 in second question');
|
||||
is($s->totalAnswers([1,1]), 1, '..1 in third question');
|
||||
|
||||
# Add a second answer to second section, second question
|
||||
$address = $s->newObject([1,1]);
|
||||
is($s->totalSections, 2, 'Still 2 sections');
|
||||
is($s->totalQuestions, 3, '..and 3 questions');
|
||||
is($s->totalAnswers, 3, '..and now 3 answer overall');
|
||||
is($s->totalAnswers([0,0]), 0, '..0 in first question');
|
||||
is($s->totalAnswers([1,0]), 1, '..1 in second question');
|
||||
is($s->totalAnswers([1,1]), 2, '..2 in third question');
|
||||
}
|
||||
|
||||
####################################################
|
||||
#
|
||||
# log
|
||||
#
|
||||
####################################################
|
||||
|
||||
WebGUI::Test->interceptLogging;
|
||||
|
||||
my $logger = $surveyJSON->log("Everyone in here is innocent");
|
||||
is ($WebGUI::Test::logger_warns, undef, 'Did not log a warn');
|
||||
is ($WebGUI::Test::logger_info, undef, 'Did not log an info');
|
||||
is ($WebGUI::Test::logger_error, "Everyone in here is innocent", 'Logged an error');
|
||||
isa_ok($surveyJSON->session, 'WebGUI::Session', 'session() accessor works');
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -2030,7 +2090,7 @@ is ($WebGUI::Test::logger_error, "Everyone in here is innocent", 'Logged an erro
|
|||
sub summarizeSectionSkeleton {
|
||||
my ($skeleton) = @_;
|
||||
my $summary = [];
|
||||
foreach my $section (@{ $skeleton->{sections} }) {
|
||||
foreach my $section (@{ $skeleton->{_sections} }) {
|
||||
my $summarySection = {
|
||||
title => $section->{title},
|
||||
questions => [],
|
||||
|
|
@ -2091,6 +2151,7 @@ sub getBareSkeletons {
|
|||
terminal => 0,
|
||||
terminalUrl => '',
|
||||
goto => '',
|
||||
gotoExpression => '',
|
||||
timeLimit => 0,
|
||||
type => 'section',
|
||||
questions => [],
|
||||
|
|
@ -2111,6 +2172,8 @@ sub getBareSkeletons {
|
|||
textInButton => 0,
|
||||
type => 'question',
|
||||
answers => [],
|
||||
goto => '',
|
||||
gotoExpression => '',
|
||||
},
|
||||
{
|
||||
text => '',
|
||||
|
|
@ -2118,6 +2181,7 @@ sub getBareSkeletons {
|
|||
textCols => 10,
|
||||
textRows => 5,
|
||||
goto => '',
|
||||
gotoExpression => '',
|
||||
recordedAnswer => '',
|
||||
isCorrect => 1,
|
||||
min => 1,
|
||||
|
|
|
|||
|
|
@ -287,8 +287,6 @@ my $tempStor = WebGUI::Storage->createTemp($session);
|
|||
|
||||
isa_ok( $tempStor, "WebGUI::Storage", "createTemp creates WebGUI::Storage object");
|
||||
is (substr($tempStor->getPathFrag, 0, 5), 'temp/', 'createTemp puts stuff in the temp directory');
|
||||
use Data::Dumper;
|
||||
diag Dumper $tempStor->getErrors();
|
||||
ok (-e $tempStor->getPath(), 'createTemp: directory was created');
|
||||
|
||||
####################################################
|
||||
|
|
|
|||
|
|
@ -8,49 +8,29 @@ if (typeof Survey === "undefined") {
|
|||
var CLASS_INVALID = 'survey-invalid'; // For elements that fail input validation
|
||||
var CLASS_INVALID_MARKER = 'survey-invalid-marker'; // For default '*' invalid field marker
|
||||
|
||||
var multipleChoice = {
|
||||
'Multiple Choice': 1,
|
||||
'Gender': 1,
|
||||
'Yes/No': 1,
|
||||
'True/False': 1,
|
||||
'Ideology': 1,
|
||||
'Race': 1,
|
||||
'Party': 1,
|
||||
'Education': 1,
|
||||
'Scale': 1,
|
||||
'Agree/Disagree': 1,
|
||||
'Oppose/Support': 1,
|
||||
'Importance': 1,
|
||||
'Likelihood': 1,
|
||||
'Certainty': 1,
|
||||
'Satisfaction': 1,
|
||||
'Confidence': 1,
|
||||
'Effectiveness': 1,
|
||||
'Concern': 1,
|
||||
'Risk': 1,
|
||||
'Threat': 1,
|
||||
'Security': 1
|
||||
};
|
||||
var text = {
|
||||
// All specially-handled question types are listed here
|
||||
// (anything else is assumed to be a multi-choice bundle)
|
||||
var TEXT_TYPES = {
|
||||
'Text': 1,
|
||||
'Email': 1,
|
||||
'Phone Number': 1,
|
||||
'Text Date': 1,
|
||||
'Currency': 1
|
||||
'Currency': 1,
|
||||
'TextArea': 1
|
||||
};
|
||||
var slider = {
|
||||
var SLIDER_TYPES = {
|
||||
'Slider': 1,
|
||||
'Dual Slider - Range': 1,
|
||||
'Multi Slider - Allocate': 1
|
||||
};
|
||||
var dateType = {
|
||||
var DATE_TYPES = {
|
||||
'Date': 1,
|
||||
'Date Range': 1
|
||||
};
|
||||
var fileUpload = {
|
||||
var UPLOAD_TYPES = {
|
||||
'File Upload': 1
|
||||
};
|
||||
var hidden = {
|
||||
var HIDDEN_TYPES = {
|
||||
'Hidden': 1
|
||||
};
|
||||
|
||||
|
|
@ -353,7 +333,6 @@ if (typeof Survey === "undefined") {
|
|||
if (lastSection !== s.id || s.everyPageText === '1') {
|
||||
document.getElementById('headertext').style.display = 'block';
|
||||
}
|
||||
|
||||
if (lastSection !== s.id && s.questionsOnSectionPage !== '1') {
|
||||
var span = document.createElement("div");
|
||||
span.innerHTML = "<input type=button id='showQuestionsButton' value='Continue'>";
|
||||
|
|
@ -385,11 +364,16 @@ if (typeof Survey === "undefined") {
|
|||
Survey.Form.addWidgets(qs);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
addWidgets: function(qs){
|
||||
hasFile = false;
|
||||
for (var i = 0; i < qs.length; i++) {
|
||||
var q = qs[i];
|
||||
if (!q || !q.answers) {
|
||||
// gracefully handle q with no answers
|
||||
continue;
|
||||
}
|
||||
|
||||
var verts = '';
|
||||
for (var x in q.answers) {
|
||||
if (YAHOO.lang.hasOwnProperty(q.answers, x)) {
|
||||
|
|
@ -411,98 +395,99 @@ if (typeof Survey === "undefined") {
|
|||
}
|
||||
|
||||
|
||||
if (multipleChoice[q.questionType]) {
|
||||
var butts = [];
|
||||
verb = 0;
|
||||
for (var j = 0; j < q.answers.length; j++) {
|
||||
var a = q.answers[j];
|
||||
if (DATE_TYPES[q.questionType]) {
|
||||
for (var k = 0; k < q.answers.length; k++) {
|
||||
var ans = q.answers[k];
|
||||
if (toValidate[q.id]) {
|
||||
toValidate[q.id].answers[a.id] = 1;
|
||||
toValidate[q.id].answers[ans.id] = 1;
|
||||
}
|
||||
var b = document.getElementById(a.id + 'button');
|
||||
/*
|
||||
b = new YAHOO.widget.Button({ type: "checkbox", label: a.answerText, id: a.id+'button', name: a.id+'button',
|
||||
value: a.id,
|
||||
container: a.id+"container", checked: false });
|
||||
*/
|
||||
// b.on("click", buttonChanged,[b,a.id,q.maxAnswers,butts,qs.length,a.id]);
|
||||
// YAHOO.util.Event.addListener(a.id+'button', "click", buttonChanged,[b,a.id,q.maxAnswers,butts,qs.length,a.id]);
|
||||
if (a.verbatim) {
|
||||
verb = 1;
|
||||
}
|
||||
YAHOO.util.Event.addListener(a.id + 'button', "click", buttonChanged, [b, a.id, q.maxAnswers, butts, qs.length, a.id]);
|
||||
b.hid = a.id;
|
||||
butts.push(b);
|
||||
var calid = ans.id + 'container';
|
||||
var c = new YAHOO.widget.Calendar(calid, {
|
||||
title: 'Choose a date:',
|
||||
close: true
|
||||
});
|
||||
c.selectEvent.subscribe(selectCalendar, [c, ans.id], true);
|
||||
c.render();
|
||||
c.hide();
|
||||
var btn = new YAHOO.widget.Button({
|
||||
label: "Select Date",
|
||||
id: "pushbutton" + ans.id,
|
||||
container: ans.id + 'button'
|
||||
});
|
||||
btn.on("click", showCalendar, [c]);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else
|
||||
if (dateType[q.questionType]) {
|
||||
for (var k = 0; k < q.answers.length; k++) {
|
||||
var ans = q.answers[k];
|
||||
if (toValidate[q.id]) {
|
||||
toValidate[q.id].answers[ans.id] = 1;
|
||||
|
||||
if (SLIDER_TYPES[q.questionType]) {
|
||||
//First run through and put up the span placeholders and find the max value for an answer, to know how big the allocation points will be.
|
||||
var max = 0;
|
||||
if (q.questionType === 'Dual Slider - Range') {
|
||||
handleDualSliders(q);
|
||||
}
|
||||
else {
|
||||
for (var s in q.answers) {
|
||||
if (YAHOO.lang.hasOwnProperty(q.answers, s)) {
|
||||
var a1 = q.answers[s];
|
||||
YAHOO.util.Event.addListener(a1.id, "blur", sliderTextSet);
|
||||
if (a1.max - a1.min > max) {
|
||||
max = a1.max - a1.min;
|
||||
}
|
||||
}
|
||||
var calid = ans.id + 'container';
|
||||
var c = new YAHOO.widget.Calendar(calid, {
|
||||
title: 'Choose a date:',
|
||||
close: true
|
||||
});
|
||||
c.selectEvent.subscribe(selectCalendar, [c, ans.id], true);
|
||||
c.render();
|
||||
c.hide();
|
||||
var btn = new YAHOO.widget.Button({
|
||||
label: "Select Date",
|
||||
id: "pushbutton" + ans.id,
|
||||
container: ans.id + 'button'
|
||||
});
|
||||
btn.on("click", showCalendar, [c]);
|
||||
}
|
||||
}
|
||||
if (q.questionType === 'Multi Slider - Allocate') {
|
||||
//sliderManagers[sliderManagers.length] = new this.sliderManager(q,max);
|
||||
for (var x1 = 0; x1 < q.answers.length; x1++) {
|
||||
if (toValidate[q.id]) {
|
||||
toValidate[q.id].total = q.answers[x1].max;
|
||||
toValidate[q.id].answers[q.answers[x1].id] = 1;
|
||||
}
|
||||
}
|
||||
sliderManager(q, max);
|
||||
}
|
||||
else
|
||||
if (slider[q.questionType]) {
|
||||
//First run through and put up the span placeholders and find the max value for an answer, to know how big the allocation points will be.
|
||||
var max = 0;
|
||||
if (q.questionType === 'Dual Slider - Range') {
|
||||
handleDualSliders(q);
|
||||
}
|
||||
else {
|
||||
for (var s in q.answers) {
|
||||
if (YAHOO.lang.hasOwnProperty(q.answers, s)) {
|
||||
var a1 = q.answers[s];
|
||||
YAHOO.util.Event.addListener(a1.id, "blur", sliderTextSet);
|
||||
if (a1.max - a1.min > max) {
|
||||
max = a1.max - a1.min;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (q.questionType === 'Multi Slider - Allocate') {
|
||||
//sliderManagers[sliderManagers.length] = new this.sliderManager(q,max);
|
||||
for (var x1 = 0; x1 < q.answers.length; x1++) {
|
||||
if (toValidate[q.id]) {
|
||||
toValidate[q.id].total = q.answers[x1].max;
|
||||
toValidate[q.id].answers[q.answers[x1].id] = 1;
|
||||
}
|
||||
}
|
||||
sliderManager(q, max);
|
||||
}
|
||||
else
|
||||
if (q.questionType === 'Slider') {
|
||||
handleSliders(q);
|
||||
}
|
||||
if (q.questionType === 'Slider') {
|
||||
handleSliders(q);
|
||||
}
|
||||
|
||||
else
|
||||
if (fileUpload[q.questionType]) {
|
||||
hasFile = true;
|
||||
}
|
||||
|
||||
else
|
||||
if (text[q.questionType]) {
|
||||
if (toValidate[q.id]) {
|
||||
toValidate[q.id].answers[q.answers[x].id] = 1;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (UPLOAD_TYPES[q.questionType]) {
|
||||
hasFile = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (TEXT_TYPES[q.questionType]) {
|
||||
if (toValidate[q.id]) {
|
||||
toValidate[q.id].answers[q.answers[x].id] = 1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// Must be a multi-choice bundle
|
||||
var butts = [];
|
||||
verb = 0;
|
||||
for (var j = 0; j < q.answers.length; j++) {
|
||||
var a = q.answers[j];
|
||||
if (toValidate[q.id]) {
|
||||
toValidate[q.id].answers[a.id] = 1;
|
||||
}
|
||||
var b = document.getElementById(a.id + 'button');
|
||||
/*
|
||||
b = new YAHOO.widget.Button({ type: "checkbox", label: a.answerText, id: a.id+'button', name: a.id+'button',
|
||||
value: a.id,
|
||||
container: a.id+"container", checked: false });
|
||||
*/
|
||||
// b.on("click", buttonChanged,[b,a.id,q.maxAnswers,butts,qs.length,a.id]);
|
||||
// YAHOO.util.Event.addListener(a.id+'button', "click", buttonChanged,[b,a.id,q.maxAnswers,butts,qs.length,a.id]);
|
||||
if (a.verbatim) {
|
||||
verb = 1;
|
||||
}
|
||||
YAHOO.util.Event.addListener(a.id + 'button', "click", buttonChanged, [b, a.id, q.maxAnswers, butts, qs.length, a.id]);
|
||||
b.hid = a.id;
|
||||
butts.push(b);
|
||||
}
|
||||
}
|
||||
YAHOO.util.Event.addListener("submitbutton", "click", formsubmit);
|
||||
}
|
||||
|
|
@ -514,4 +499,4 @@ if (typeof Survey === "undefined") {
|
|||
YAHOO.util.Event.onDOMReady(function(){
|
||||
// Survey.Comm.setUrl('/' + document.getElementById('assetPath').value);
|
||||
Survey.Comm.callServer('', 'loadQuestions');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ var Dom = YAHOO.util.Dom;
|
|||
var Event = YAHOO.util.Event;
|
||||
var DDM = YAHOO.util.DragDropMgr;
|
||||
|
||||
var currentDest;
|
||||
|
||||
Survey.DDList = function(id, sGroup, config) {
|
||||
|
||||
Survey.DDList.superclass.constructor.call(this, id, sGroup, config);
|
||||
|
|
@ -61,30 +63,10 @@ YAHOO.extend(Survey.DDList, YAHOO.util.DDProxy, {
|
|||
a.animate();
|
||||
},
|
||||
|
||||
onInvalidDrop: function(e, id) {
|
||||
Survey.Data.dragDrop(this.getEl());
|
||||
},
|
||||
onDragDrop: function(e, id) {
|
||||
|
||||
// If there is one drop interaction, the li was dropped either on the list,
|
||||
// or it was dropped on the current location of the source element.
|
||||
if (DDM.interactionInfo.drop.length === 1) {
|
||||
|
||||
// The position of the cursor at the time of the drop (YAHOO.util.Point)
|
||||
var pt = DDM.interactionInfo.point;
|
||||
|
||||
// The region occupied by the source element at the time of the drop
|
||||
var region = DDM.interactionInfo.sourceRegion;
|
||||
|
||||
// Check to see if we are over the source element's location. We will
|
||||
// append to the bottom of the list once we are sure it was a drop in
|
||||
// the negative space (the area of the list without any list items)
|
||||
if (!region.intersect(pt)) {
|
||||
var destEl = Dom.get(id);
|
||||
var destDD = DDM.getDDById(id);
|
||||
destEl.appendChild(this.getEl());
|
||||
destDD.isEmpty = false;
|
||||
DDM.refreshCache();
|
||||
}
|
||||
|
||||
}
|
||||
Survey.Data.dragDrop(this.getEl());
|
||||
},
|
||||
|
||||
|
|
@ -110,6 +92,8 @@ YAHOO.extend(Survey.DDList, YAHOO.util.DDProxy, {
|
|||
// We are only concerned with list items, we ignore the dragover
|
||||
// notifications for the list.
|
||||
if (destEl.nodeName.toLowerCase() == "li") {
|
||||
currentDest = destEl;
|
||||
console.log(destEl);
|
||||
var orig_p = srcEl.parentNode;
|
||||
var p = destEl.parentNode;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,134 +1,154 @@
|
|||
if (typeof Survey == "undefined") {
|
||||
/*global Survey, YAHOO */
|
||||
if (typeof Survey === "undefined") {
|
||||
var Survey = {};
|
||||
}
|
||||
|
||||
Survey.Data = new function(){
|
||||
Survey.Data = (function(){
|
||||
|
||||
var lastDataSet = {};
|
||||
var focus;
|
||||
var lastId = -1;
|
||||
|
||||
// Keep references to widgets here so that we can destory any instances before
|
||||
// creating new ones (to avoid memory leaks)
|
||||
var autoComplete;
|
||||
var sButton, qButton, aButton;
|
||||
|
||||
this.dragDrop = function(did){
|
||||
var type;
|
||||
YAHOO.log('In drag drop');
|
||||
if(did.className.match("section")){type = 'section';}
|
||||
else if(did.className.match("question")){type = 'question';}
|
||||
else{ type = 'answer';}
|
||||
|
||||
var first = {id:did.id,type:type};
|
||||
var before = document.getElementById(did.id).previousSibling;
|
||||
|
||||
while(1){
|
||||
if( before == undefined || (before.id != undefined && before.id != '') ){
|
||||
break;
|
||||
}
|
||||
var before = before.previousSibling;
|
||||
}
|
||||
|
||||
var data = {id:'',type:''};
|
||||
|
||||
if(before != undefined && before.id != undefined && before.id != ''){
|
||||
if(before.className.match("section")){type = 'section';}
|
||||
else if(before.className.match("question")){type = 'question';}
|
||||
else{ type = 'answer';}
|
||||
data = {id:before.id,type:type};
|
||||
}
|
||||
YAHOO.log(first.id+' '+data.id);
|
||||
Survey.Comm.dragDrop(first,data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.clicked = function(){
|
||||
Survey.Comm.loadSurvey(this.id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.loadData = function(d){
|
||||
focus = d.address;//What is the current highlighted item.
|
||||
var showEdit = 1;
|
||||
if(lastId.toString() == d.address.toString()){
|
||||
showEdit = 0;
|
||||
lastId = -1;
|
||||
}else{
|
||||
lastId = d.address;
|
||||
}
|
||||
document.getElementById('sections').innerHTML=d.ddhtml;
|
||||
|
||||
//add event handlers for if a tag is clicked
|
||||
for(var x in d.ids){
|
||||
YAHOO.log('adding handler for '+ d.ids[x]);
|
||||
YAHOO.util.Event.addListener(d.ids[x], "click", this.clicked);
|
||||
new Survey.DDList(d.ids[x],"sections");
|
||||
}
|
||||
|
||||
//add the add object buttons
|
||||
// if(d.buttons['section']){
|
||||
document.getElementById('addSection').innerHTML = '';
|
||||
document.getElementById('addQuestion').innerHTML = '';
|
||||
document.getElementById('addAnswer').innerHTML = '';
|
||||
var button = new YAHOO.widget.Button({ label:"Add Section", id:"addsection", container:"addSection" });
|
||||
button.on("click", this.addSection);
|
||||
// }
|
||||
// if(d.buttons['question']){
|
||||
var button = new YAHOO.widget.Button({ label:"Add Question", id:"addquestion", container:"addQuestion" });
|
||||
button.on("click", this.addQuestion,d.buttons['question']);
|
||||
// }
|
||||
if(d.buttons['answer']){
|
||||
var button = new YAHOO.widget.Button({ label:"Add Answer", id:"addanswer", container:"addAnswer" });
|
||||
button.on("click", this.addAnswer,d.buttons['answer']);
|
||||
}
|
||||
|
||||
if(showEdit == 1){
|
||||
this.loadObjectEdit(d.edithtml,d.type);
|
||||
}else{
|
||||
document.getElementById('edit').innerHTML = "";
|
||||
}
|
||||
lastDataSet = d;
|
||||
}
|
||||
|
||||
this.addSection = function(){
|
||||
Survey.Comm.newSection();
|
||||
}
|
||||
|
||||
|
||||
this.addQuestion = function(e,id){
|
||||
Survey.Comm.newQuestion(id);
|
||||
}
|
||||
|
||||
this.addAnswer = function(e,id){
|
||||
Survey.Comm.newAnswer(id);
|
||||
}
|
||||
|
||||
this.loadObjectEdit = function(edit,type){
|
||||
if(edit){
|
||||
Survey.ObjectTemplate.loadObject(edit,type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.loadLast = function(){
|
||||
this.loadData(lastDataSet);
|
||||
}
|
||||
}();
|
||||
|
||||
|
||||
//----------------------------------------------------------------
|
||||
//
|
||||
// Initialize survey
|
||||
//
|
||||
//----------------------------------------------------------------
|
||||
Survey.OnLoad = function() {
|
||||
var e = YAHOO.util.Event;
|
||||
return {
|
||||
init: function() {
|
||||
e.onDOMReady(this.initHandler);
|
||||
},
|
||||
initHandler: function(){
|
||||
new YAHOO.util.DDTarget("sections","sections");
|
||||
Survey.Comm.loadSurvey();
|
||||
},
|
||||
}
|
||||
}();
|
||||
dragDrop: function(did){
|
||||
|
||||
Survey.OnLoad.init();
|
||||
YAHOO.log('In drag drop');
|
||||
var type = did.className.match("section") ? 'section'
|
||||
: did.className.match("question") ? 'question'
|
||||
: 'answer';
|
||||
|
||||
var first = {
|
||||
id: did.id, // pre-drag index of item
|
||||
type: type
|
||||
};
|
||||
var before = YAHOO.util.Dom.getPreviousSiblingBy( document.getElementById(did.id), function(node){
|
||||
return node.id; // true iff node has a non-empty id
|
||||
});
|
||||
|
||||
var data = {
|
||||
id: '',
|
||||
type: ''
|
||||
};
|
||||
|
||||
if (before) {
|
||||
type = before.className.match("section") ? 'section'
|
||||
: before.className.match("question") ? 'question'
|
||||
: 'answer';
|
||||
data = {
|
||||
id: before.id,
|
||||
type: type
|
||||
};
|
||||
}
|
||||
YAHOO.log(first.id + ' ' + data.id);
|
||||
Survey.Comm.dragDrop(first, data);
|
||||
},
|
||||
|
||||
clicked: function(){
|
||||
Survey.Comm.loadSurvey(this.id);
|
||||
},
|
||||
|
||||
loadData: function(d){
|
||||
focus = d.address;//What is the current highlighted item.
|
||||
var showEdit = 1;
|
||||
if (lastId.toString() === d.address.toString()) {
|
||||
showEdit = 0;
|
||||
lastId = -1;
|
||||
}
|
||||
else {
|
||||
lastId = d.address;
|
||||
}
|
||||
|
||||
// First purge any event handlers bound to sections node..
|
||||
YAHOO.util.Event.purgeElement('sections', true);
|
||||
|
||||
// Now we can re-write its innerHTML without fear of memory leaks
|
||||
document.getElementById('sections').innerHTML = d.ddhtml;
|
||||
|
||||
//add event handlers for if a tag is clicked
|
||||
for (var x in d.ids) {
|
||||
if (YAHOO.lang.hasOwnProperty(d.ids, x)) {
|
||||
YAHOO.log('adding handler for ' + d.ids[x]);
|
||||
YAHOO.util.Event.addListener(d.ids[x], "click", this.clicked);
|
||||
var _s = new Survey.DDList(d.ids[x], "sections");
|
||||
}
|
||||
}
|
||||
|
||||
sButton && sButton.destroy();
|
||||
sButton = new YAHOO.widget.Button({
|
||||
label: "Add Section",
|
||||
id: "addsection",
|
||||
container: "addSection"
|
||||
});
|
||||
sButton.on("click", this.addSection);
|
||||
|
||||
qButton && qButton.destroy();
|
||||
qButton = new YAHOO.widget.Button({
|
||||
label: "Add Question",
|
||||
id: "addquestion",
|
||||
container: "addQuestion"
|
||||
});
|
||||
qButton.on("click", this.addQuestion, d.buttons.question);
|
||||
|
||||
if (d.buttons.answer) {
|
||||
aButton && aButton.destroy();
|
||||
aButton = new YAHOO.widget.Button({
|
||||
label: "Add Answer",
|
||||
id: "addanswer",
|
||||
container: "addAnswer"
|
||||
});
|
||||
aButton.on("click", this.addAnswer, d.buttons.answer);
|
||||
}
|
||||
|
||||
if (showEdit == 1) {
|
||||
this.loadObjectEdit(d.edithtml, d.type);
|
||||
|
||||
// build the goto auto-complete widget
|
||||
if (d.gotoTargets && document.getElementById('goto')) {
|
||||
var ds = new YAHOO.util.LocalDataSource(d.gotoTargets);
|
||||
autoComplete = new YAHOO.widget.AutoComplete('goto', 'goto-yui-ac-container', ds);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Survey.ObjectTemplate.unloadObject();
|
||||
if (autoComplete) {
|
||||
autoComplete.destroy();
|
||||
autoComplete = null;
|
||||
}
|
||||
}
|
||||
lastDataSet = d;
|
||||
},
|
||||
|
||||
addSection: function(){
|
||||
Survey.Comm.newSection();
|
||||
},
|
||||
|
||||
addQuestion: function(e, id){
|
||||
Survey.Comm.newQuestion(id);
|
||||
},
|
||||
|
||||
addAnswer: function(e, id){
|
||||
Survey.Comm.newAnswer(id);
|
||||
},
|
||||
|
||||
loadObjectEdit: function(edit, type){
|
||||
if (edit) {
|
||||
Survey.ObjectTemplate.loadObject(edit, type);
|
||||
}
|
||||
},
|
||||
|
||||
loadLast: function(){
|
||||
this.loadData(lastDataSet);
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
// Initialize survey
|
||||
YAHOO.util.Event.onDOMReady(function(){
|
||||
var ddTarget = new YAHOO.util.DDTarget("sections", "sections");
|
||||
Survey.Comm.loadSurvey();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,69 +0,0 @@
|
|||
if (typeof Survey == "undefined") {
|
||||
var Survey = {};
|
||||
}
|
||||
|
||||
Survey.AnswerTemplate = new function(){
|
||||
this.params;
|
||||
this.loadAnswer = function(params){
|
||||
for(var p in params){
|
||||
if(params[p] == undefined){params[p] = '';}
|
||||
}
|
||||
|
||||
var html = "\
|
||||
<div id='answer'>\
|
||||
<div class='hd'>Please enter answer information</div>\
|
||||
<div class='bd'>\
|
||||
\
|
||||
<form name='form' method='POST' action='?func=submitAnswerEdit'>\
|
||||
\
|
||||
<p>Answer Number: "+params.sequenceNumber + "\
|
||||
\
|
||||
<input type='hidden' name='Survey_sectionId' value='"+params.Survey_sectionId+"'>\
|
||||
<input type='hidden' name='Survey_questionId' value='"+params.Survey_questionId+"'>\
|
||||
<input type='hidden' name='Survey_answerId' value='"+params.Survey_answerId+"'>";
|
||||
html = html + "<p>Answer Text:\n<textarea name='answerText'>"+params.answerText+"</textArea>\n";
|
||||
html = html + "<p>Recorded Answer\n<textarea name='recordedAnswer'>"+params.recordedAnswer+"</textArea>\n";
|
||||
html = html + "<p>Jump to:<input type=text value='"+params.gotoQuestion+"' name=gotoQuestion size=4>";
|
||||
html = html + "<span id='textParams'><p>Text Answer Cols:<input type=text size=2 value='"+params.textCols+"' name=textCols> Rows: \
|
||||
<input type=text size=2 value='"+params.textRows+"' name=textRows> </p></span>";
|
||||
html = html + "<p>Is this the correct answer:\n" +
|
||||
this.makeRadio('isCorrect',[{text:'Yes',value:1},{text:'No',value:0}],params.isCorrect);
|
||||
html = html + "<p>Min:<input type=text value='"+params.min+"' name=min size=2>";
|
||||
html = html + "<p>Max:<input type=text value='"+params.max+"' name=max size=2>";
|
||||
html = html + "<p>Step:<input type=text value='"+params.step+"' name=step size=2>";
|
||||
html = html + "<p>Verbatim:\n" +
|
||||
this.makeRadio('verbatim',[{text:'Yes',value:1},{text:'No',value:0}],params.verbatim);
|
||||
document.getElementById('edit').innerHTML = html;
|
||||
|
||||
var butts = [{ text:"Submit", handler:function(){this.submit();}, isDefault:true },{ text:"Cancel", handler:function(){this.cancel();}} ];
|
||||
if(params.Survey_answerId != ''){
|
||||
butts[2] = { text:"Delete", handler:function(){Survey.Comm.deleteAnswer(Survey.AnswerTemplate.params.Survey_answerId);}};
|
||||
}
|
||||
|
||||
var form = new YAHOO.widget.Dialog("answer",
|
||||
{ width : "500px",
|
||||
fixedcenter : true,
|
||||
visible : false,
|
||||
constraintoviewport : true,
|
||||
buttons : butts
|
||||
});
|
||||
|
||||
form.callback = Survey.Comm.callback;
|
||||
form.render();
|
||||
form.show();
|
||||
this.params = params;
|
||||
};
|
||||
|
||||
this.makeRadio = function(name,values,checked){
|
||||
var html = '';
|
||||
for(var i in values){
|
||||
if(checked == values[i]['value']){
|
||||
html = html+ "<input type='radio' name='" + name + "' value='" + values[i]['value'] + "' checked>" + values[i]['text'];
|
||||
}else{
|
||||
html = html+ "<input type='radio' name='" + name + "' value='" + values[i]['value'] + "' >" + values[i]['text'];
|
||||
}
|
||||
}
|
||||
html = html + "\n";
|
||||
return html;
|
||||
}
|
||||
}();
|
||||
|
|
@ -1,33 +1,128 @@
|
|||
if (typeof Survey == "undefined") {
|
||||
|
||||
/*global Survey, YAHOO */
|
||||
if (typeof Survey === "undefined") {
|
||||
var Survey = {};
|
||||
}
|
||||
|
||||
Survey.ObjectTemplate = new function(){
|
||||
Survey.ObjectTemplate = (function(){
|
||||
|
||||
this.loadObject = function(html,type){
|
||||
// Keep references to widgets here so that we can destory any instances before
|
||||
// creating new ones (to avoid memory leaks)
|
||||
var dialog;
|
||||
var editor;
|
||||
|
||||
document.getElementById('edit').innerHTML = html;
|
||||
return {
|
||||
|
||||
unloadObject: function(){
|
||||
// First destory the editor..
|
||||
if (editor) {
|
||||
editor.destroy();
|
||||
editor = null;
|
||||
}
|
||||
|
||||
// And then the Dialog that contains it.
|
||||
if (dialog) {
|
||||
dialog.destroy();
|
||||
dialog = null;
|
||||
}
|
||||
},
|
||||
|
||||
var butts = [
|
||||
{ text:"Submit", handler:function(){this.submit();}, isDefault:true },
|
||||
{ text:"Copy", handler:function(){document.getElementById('copy').value = 1; this.submit();}},
|
||||
{ text:"Cancel", handler:function(){this.cancel(); Survey.Comm.loadSurvey('-');}},
|
||||
{ text:"Delete", handler:function(){document.getElementById('delete').value = 1; this.submit();}}
|
||||
];
|
||||
loadObject: function(html, type){
|
||||
// Make sure we purge any event listeners before overwrite innerHTML..
|
||||
YAHOO.util.Event.purgeElement('edit', true);
|
||||
document.getElementById('edit').innerHTML = html;
|
||||
|
||||
var btns = [{
|
||||
text: "Submit",
|
||||
handler: function(){
|
||||
editor.saveHTML();
|
||||
this.submit();
|
||||
},
|
||||
isDefault: true
|
||||
}, {
|
||||
text: "Copy",
|
||||
handler: function(){
|
||||
document.getElementById('copy').value = 1;
|
||||
this.submit();
|
||||
}
|
||||
}, {
|
||||
text: "Cancel",
|
||||
handler: function(){
|
||||
this.cancel();
|
||||
Survey.Comm.loadSurvey('-');
|
||||
}
|
||||
}, {
|
||||
text: "Delete",
|
||||
handler: function(){
|
||||
document.getElementById('delete').value = 1;
|
||||
this.submit();
|
||||
}
|
||||
}, {
|
||||
text: "Preview",
|
||||
handler: function(){
|
||||
if (type === 'answer') {
|
||||
alert('Sorry, preview is only supported for Sections and Questions, not Answers');
|
||||
}
|
||||
else {
|
||||
var msg = 'This will delete any Survey responses you have made under this ' +
|
||||
'user account and redirect you to the Take Survey page starting at the selected item. ' +
|
||||
"\n\nAre you sure you want to continue?";
|
||||
if (confirm(msg)) {
|
||||
window.location.search = 'func=jumpTo;id=' + dialog.getData().id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}];
|
||||
|
||||
dialog = new YAHOO.widget.Dialog(type, {
|
||||
width: "600px",
|
||||
context: [document.body, 'tr', 'tr'],
|
||||
visible: false,
|
||||
constraintoviewport: true,
|
||||
buttons: btns
|
||||
});
|
||||
|
||||
dialog.callback = Survey.Comm.callback;
|
||||
dialog.render();
|
||||
|
||||
var form = new YAHOO.widget.Dialog(type,
|
||||
{
|
||||
width : "500px",
|
||||
fixedcenter : true,
|
||||
visible : false,
|
||||
constraintoviewport : true,
|
||||
buttons : butts
|
||||
} );
|
||||
// if(type == 'question'){
|
||||
// var resize = new YAHOO.util.Resize('resize_randomWords_formId');
|
||||
// resize.on('resize', function(ev) {
|
||||
// YAHOO.util.Dom.setStyle('randomWords_formId', 'width', (ev.width - 6) + "px");
|
||||
// YAHOO.util.Dom.setStyle('randomWords_formId', 'height', (ev.height - 6) + "px");
|
||||
// });
|
||||
// }
|
||||
|
||||
form.callback = Survey.Comm.callback;
|
||||
form.render();
|
||||
form.show();
|
||||
initHoverHelp(type);
|
||||
}
|
||||
}();
|
||||
if(type == 'answer'){
|
||||
var resize = new YAHOO.util.Resize('resize_gotoExpression_formId');
|
||||
resize.on('resize', function(ev) {
|
||||
YAHOO.util.Dom.setStyle('gotoExpression_formId', 'width', (ev.width - 6) + "px");
|
||||
YAHOO.util.Dom.setStyle('gotoExpression_formId', 'height', (ev.height - 6) + "px");
|
||||
});
|
||||
}
|
||||
|
||||
var textareaId = type + 'Text';
|
||||
var textarea = YAHOO.util.Dom.get(textareaId);
|
||||
|
||||
var height = YAHOO.util.Dom.getStyle(textarea, 'height');
|
||||
if (!height) {
|
||||
height = '300px';
|
||||
}
|
||||
|
||||
// N.B. SimpleEditor has a memory leak so this eats memory on every instantiation
|
||||
editor = new YAHOO.widget.SimpleEditor(textareaId, {
|
||||
height: height,
|
||||
width: '100%',
|
||||
dompath: false //Turns on the bar at the bottom
|
||||
});
|
||||
|
||||
if (editor.get('toolbar')) {
|
||||
editor.get('toolbar').titlebar = false;
|
||||
}
|
||||
editor.render();
|
||||
|
||||
dialog.show();
|
||||
initHoverHelp(type);
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -1,40 +0,0 @@
|
|||
<div id='question'>
|
||||
<div class='hd'>Please enter question information</div>
|
||||
<div class='bd'>
|
||||
<form name='form' method='POST' action='?func=submitObjectEdit'>
|
||||
<p>Question Number: <tmpl_var displayed_id>
|
||||
<input type='hidden' name='id' value='<tmpl_var id>'>
|
||||
<p>Question Text:\n";
|
||||
<textarea name='questionText'><tmpl_var text></textArea>\n";
|
||||
<p>Question variable name:<input maxlength=35 size=10 type=text value='<tmpl_var variable>' name=variable size=2></p>";
|
||||
<p>Randomize answers:";
|
||||
<input type='radio' name='randomizeAnswers' value=1 <tmpl_if randomizeAnswers>checked</tmpl_if>>Yes
|
||||
<input type='radio' name='randomizeAnswers' value=0 <tmpl_unless randomizeAnswers>checked</tmpl_unless>>No
|
||||
<p>Question type:
|
||||
<select name='questionType'>
|
||||
<tmpl_loop questionType>
|
||||
<option value='<tmpl_var text>' <tmpl_if selected>selected</tmpl_if>><tmpl_var text></option>
|
||||
</tmpl_loop>
|
||||
</select>
|
||||
<p>Randomized words:
|
||||
<textarea name=randomizWords><tmpl_var randomWords></textArea>
|
||||
<p>Vertical display:
|
||||
<input type='radio' name='verticalDisplay' value=1 <tmpl_if verticalDisplay>checked</tmpl_if>>Yes
|
||||
<input type='radio' name='verticalDisplay' value=0 <tmpl_unless verticalDisplay>checked</tmpl_unless>>No
|
||||
|
||||
<p>Show text in button:
|
||||
<input type='radio' name='textInButton' value=1 <tmpl_if textInButton>checked</tmpl_if>>Yes
|
||||
<input type='radio' name='textInButton' value=0 <tmpl_unless textInButton>checked</tmpl_unless>>No
|
||||
|
||||
<p>Allow comment:
|
||||
<input type='radio' name='allowComment' value=1 <tmpl_if allowComment>checked</tmpl_if>>Yes
|
||||
<input type='radio' name='allowComment' value=0 <tmpl_unless allowComment>checked</tmpl_unlexx>>No
|
||||
<span id='commentParams'><p> Cols:<input type=text size=2 value='<tmpl_var commentCols>' name=commentCols> Rows:
|
||||
<input type=text size=2 value='<tmpl_var commentRows>' name=commentRows> </p></span>
|
||||
<p>Maximum number of answers:<input type=text value='<tmpl_var maxAnswers>' name=maxAnswers size=2>
|
||||
<p>Required:
|
||||
<input type='radio' name='required' value=1 <tmpl_if required>checked</tmpl_if>>Yes
|
||||
<input type='radio' name='required' value=0 <tmpl_unless required>checked</tmpl_unless>>No
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,112 +0,0 @@
|
|||
if (typeof Survey == "undefined") {
|
||||
var Survey = {};
|
||||
}
|
||||
|
||||
Survey.QuestionTemplate = new function(){
|
||||
|
||||
this.loadQuestion = function(params){
|
||||
|
||||
for(var p in params){
|
||||
if(params[p] == undefined){params[p] = '';}
|
||||
}
|
||||
|
||||
var html = "\
|
||||
<div id='question'>\
|
||||
<div class='hd'>Please enter question information</div>\
|
||||
<div class='bd'>\
|
||||
\
|
||||
<form name='form' method='POST' action='?func=submitQuestionEdit'>\
|
||||
<p>Question Number: "+params.sequenceNumber + "\
|
||||
\
|
||||
<input type='hidden' name='Survey_sectionId' value='"+params.Survey_sectionId+"'>\
|
||||
<input type='hidden' name='Survey_questionId' value='"+params.Survey_questionId+"'>\
|
||||
<p>Question Text:\n";
|
||||
if(params.questionText == ''){
|
||||
html = html + "<textarea name='questionText'>Enter Text Here</textArea>\n";
|
||||
}
|
||||
else{
|
||||
html = html + "<textarea name='questionText'>"+params.questionText+"</textArea>\n";
|
||||
}
|
||||
html = html + "<p>Question variable name:<input maxlength=35 size=10 type=text value='"+ params.questionVariable +"' name=questionVariable size=2></p>";
|
||||
html = html + "<p>Randomize answers:";
|
||||
|
||||
html = html+ this.makeRadio('randomizeAnswers',[{text:'Yes',value:1},{text:'No',value:0}],params.randomizeAnswers);
|
||||
html = html + "<p>Question type:";
|
||||
var questions = ['Agree/Disagree','Certainty','Concern','Confidence','Currency','Date','Date Range','Dual Slider - Range','Education','Effectiveness',
|
||||
'Email','File Upload','Gender','Hidden','Ideology','Importance','Likelihood','Multi Slider - Allocate','Multiple Choice','Oppose/Support',
|
||||
'Party','Phone Number','Race','Risk','Satisfaction','Scale','Security','Slider','Text','Text Date','Threat','True/False','Yes/No'];
|
||||
// var questions = ['Multiple Choice','Gender','Yes/No','True/False','Agree/Disagree','Oppose/Support','Importance','Likelihood','Certainty','Satisfaction',
|
||||
// 'Confidence','Effectiveness','Concern','Risk','Threat','Security','Ideology','Race','Party','Education',
|
||||
// 'Text', 'Email', 'Phone Number', 'Text Date', 'Currency',
|
||||
// 'Slider','Dual Slider - Range','Multi Slider - Allocate', 'Date','Date Range', 'File Upload','Hidden'];
|
||||
|
||||
html = html + this.makeMenu('questionType',questions,questions,params.questionType);
|
||||
|
||||
html = html + "\
|
||||
<p>Randomized words:\
|
||||
<textarea name=randomizedWords>"+params.randomizedWords+"</textArea>\
|
||||
<p>Vertical display:";
|
||||
|
||||
html = html+ this.makeRadio('verticalDisplay',[{text:'Yes',value:1},{text:'No',value:0}],params.verticalDisplay);
|
||||
html = html + "<p>Show text in button:";
|
||||
html = html + this.makeRadio('textInButton',[{text:'Yes',value:1},{text:'No',value:0}],params.textInButton);
|
||||
html = html + "<p>Allow comment:";
|
||||
html = html + this.makeRadio('allowComment',[{text:'Yes',value:1},{text:'No',value:0}],params.allowComment);
|
||||
html = html + "<span id='commentParams'><p> Cols:<input type=text size=2 value='"+params.commentCols+"' name=commentCols> Rows: \
|
||||
<input type=text size=2 value='"+params.commentRows+"' name=commentRows> </p></span>";
|
||||
html = html + "<p>Maximum number of answers:<input type=text value='"+params.maxAnswers+"' name=maxAnswers size=2>";
|
||||
html = html + "<p>Required:";
|
||||
html = html+ this.makeRadio('required',[{text:'Yes',value:1},{text:'No',value:0}],params.required);
|
||||
html = html + "\
|
||||
</form>\
|
||||
</div>\
|
||||
</div>\
|
||||
";
|
||||
|
||||
document.getElementById('edit').innerHTML = html;
|
||||
|
||||
|
||||
var butts = [ { text:"Submit", handler:function(){this.submit();}, isDefault:true }, { text:"Cancel", handler:function(){this.cancel();}} ];
|
||||
if(params.Survey_questionId != ''){
|
||||
butts[2] = {text:"Delete", handler:function(){Survey.Comm.deleteQuestion(params.Survey_questionId);}};
|
||||
}
|
||||
|
||||
var form = new YAHOO.widget.Dialog("question",
|
||||
{ width : "500px",
|
||||
fixedcenter : true,
|
||||
visible : false,
|
||||
constraintoviewport : true,
|
||||
buttons : butts
|
||||
} );
|
||||
|
||||
form.callback = Survey.Comm.callback;
|
||||
form.render();
|
||||
form.show();
|
||||
|
||||
}
|
||||
this.makeMenu = function(name,values,text,selected){
|
||||
var html = "<select name='"+name+"'>\n";
|
||||
for(var i in values){
|
||||
if(values[i] == selected){
|
||||
html = html + "<option value='"+values[i]+"' selected>"+text[i]+"</option>\n";
|
||||
}else{
|
||||
html = html + "<option value='"+values[i]+"' >"+text[i]+"</option>\n";
|
||||
}
|
||||
}
|
||||
html = html + "</select>\n";
|
||||
return html;
|
||||
}
|
||||
this.makeRadio = function(name,values,checked){
|
||||
var html = '';
|
||||
for(var i in values){
|
||||
if(checked == values[i]['value']){
|
||||
html = html+ "<input type='radio' id='"+name+"' name='" + name + "' value='" + values[i]['value'] + "' checked>" + values[i]['text'];
|
||||
}else{
|
||||
html = html+ "<input type='radio' id='"+name+"' name='" + name + "' value='" + values[i]['value'] + "' >" + values[i]['text'];
|
||||
}
|
||||
}
|
||||
html = html + "\n";
|
||||
return html;
|
||||
}
|
||||
|
||||
}();
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
if (typeof Survey == "undefined") {
|
||||
var Survey = {};
|
||||
}
|
||||
|
||||
Survey.SectionTemplate = new function(){
|
||||
|
||||
this.loadSection = function(html){
|
||||
|
||||
document.getElementById('edit').innerHTML = html;
|
||||
|
||||
var butts = [ { text:"Submit", handler:function(){this.submit();}, isDefault:true }, { text:"Cancel", handler:function(){this.cancel();}},
|
||||
{text:"Delete", handler:function(){document.getElementById('delete').setValue(1); this.submit();}}
|
||||
];
|
||||
|
||||
var form = new YAHOO.widget.Dialog("section",
|
||||
{ width : "500px",
|
||||
fixedcenter : true,
|
||||
visible : false,
|
||||
constraintoviewport : true,
|
||||
buttons : butts
|
||||
} );
|
||||
|
||||
form.callback = Survey.Comm.callback;
|
||||
form.render();
|
||||
form.show();
|
||||
}
|
||||
}();
|
||||
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
body {
|
||||
margin: 0;
|
||||
background-repeat: repeat-y;
|
||||
background-position: 0px 0px;
|
||||
}
|
||||
.survey-header {
|
||||
width: 80%;
|
||||
height: 20px;
|
||||
margin-left: 80px;
|
||||
}
|
||||
#survey {
|
||||
margin-left: 80px;
|
||||
width: 85%;
|
||||
}
|
||||
|
||||
div.dateanswer {
|
||||
min-height: 250px;
|
||||
}
|
||||
div.slider-bg {
|
||||
position: relative;
|
||||
background:url(/extras/wobject/Survey/bg-fader-500.gif) 5px 0 no-repeat;
|
||||
height:68px;
|
||||
width:529px;
|
||||
}
|
||||
div.slider-thumb {
|
||||
cursor:default;
|
||||
position: absolute;
|
||||
top: 30px;
|
||||
left: 4px;
|
||||
}
|
||||
div.slider-min-thumb {
|
||||
cursor:default;
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
}
|
||||
div.slider-max-thumb {
|
||||
cursor:default;
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
}
|
||||
#headertitle {
|
||||
display: none;
|
||||
}
|
||||
#headertext {
|
||||
display: none;
|
||||
}
|
||||
#questions {
|
||||
display: none;
|
||||
}
|
||||
input.mcbutton{
|
||||
font-size: 10px;
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
background-color: #CCCCCC;
|
||||
background-repeat: repeat-x;
|
||||
text-align: center;
|
||||
display: block;
|
||||
margin: 0.5em;
|
||||
padding: .8em;
|
||||
width: 60px;
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
color: #000000;
|
||||
background-image: url(/extras/wobject/Survey/gradient-glossy.png);
|
||||
}
|
||||
input.mcbutton:hover{
|
||||
background-color: #B6D2F1;
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: 10px;
|
||||
color: #000000;
|
||||
}
|
||||
input.mcbutton-selected{
|
||||
background-color: #172D9D;
|
||||
background-repeat: repeat-x;
|
||||
color: #FFFFFF;
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: 10px;
|
||||
margin: 0.5em;
|
||||
padding: .8em;
|
||||
width: 60px;
|
||||
text-align: center;
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
background-image: url(/extras/wobject/Survey/gradient-glossy.png);
|
||||
background-position: 0px 0px;
|
||||
}
|
||||
|
||||
/* By default the marker for invalid (required) fields is a red '*' */
|
||||
.survey-invalid-marker {
|
||||
color: #FF0000;
|
||||
}
|
||||
|
|
@ -92,9 +92,11 @@ li.squestion {
|
|||
min-height: 10px;
|
||||
}
|
||||
li.newQuestion {
|
||||
# background-color: #D1E6EC;
|
||||
# border:1px solid #7EA6B2;
|
||||
# cursor: move;
|
||||
/*
|
||||
background-color: #D1E6EC;
|
||||
border:1px solid #7EA6B2;
|
||||
cursor: move;
|
||||
*/
|
||||
padding-left:25px;
|
||||
}
|
||||
|
||||
|
|
@ -119,14 +121,19 @@ li.sanswer {
|
|||
background-color: #CC6600;
|
||||
border:1px solid #7EA6B2;
|
||||
cursor: move;
|
||||
padding-left:50px;
|
||||
padding-left:50px;
|
||||
width:60%;
|
||||
min-height: 10px;
|
||||
}
|
||||
li.newAnswer {
|
||||
# background-color: #D1E6EC;
|
||||
# border:1px solid #7EA6B2;
|
||||
padding-left:50px;
|
||||
# cursor: move;
|
||||
/*
|
||||
background-color: #D1E6EC;
|
||||
border:1px solid #7EA6B2;
|
||||
cursor: move;
|
||||
*/
|
||||
padding-left:50px;
|
||||
}
|
||||
#goto-yui-ac {
|
||||
width:15em;
|
||||
margin-top:0.5em;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue