Merge commit 'tags/WebGUI_7.6.8-beta' into survey-rfe
* commit 'tags/WebGUI_7.6.8-beta': (96 commits) Release 7.6.8-beta preparing for 7.6.8 release convert to new storage format fixing photo comment test fixed: Syndicated Content corrupts wide characters Add the WikiPage to the list of contributions shown in the Account Contributions tab. added #!/usr/bin/env perl to all utility scripts Forward port i18n fix for Gallery Album RSS list. Fix some Survey i18n typos in the time limit hoverhelp. Large batch of Help and i18n. Also, make sure that the Fix a typo in the i18n help for the ITransact Pay Driver. Correct dataform captcha variable name in the help. Forward porting expanded patch for handling deleted things. Have Thingy check for existance of table and column to prevent Fix linking to other things and autocreating the form field for it. Update test to match fixed code. Remove the warnings pragma Only resize photos if they are larger than the Gallery resolutions. Fix a syntax error made in the i18n of the search button. I18n'ed a submit button in the manage transactions screen. ... Conflicts: lib/WebGUI/Asset/Wobject/Survey.pm lib/WebGUI/Asset/Wobject/Survey/SurveyJSON.pm www/extras/wobject/Survey/editsurvey.js www/extras/wobject/Survey/editsurvey/object.js
This commit is contained in:
commit
b7520da07d
396 changed files with 2647 additions and 1186 deletions
|
|
@ -1,3 +1,39 @@
|
|||
7.6.8
|
||||
- added #!/usr/bin/env perl to all utility scripts
|
||||
- Updated captcha images to be more legible.
|
||||
- fixed #9285: modifing template prevents edit of syncontent
|
||||
- fixed #8886: Search button in Asset manager
|
||||
- fixed #9410: Wrong help text
|
||||
- fixed #9154: WebGUI Shop - Checkout Caching Problem
|
||||
- fixed a bug where clicking the apply button when func=add would return the
|
||||
edit screen of the parent asset rather than that of the new asset. (Martin
|
||||
Kamerbeek / Oqapi).
|
||||
- fixed: Make sure that Form subclasses are found by WebGUI::Form::FieldType
|
||||
- fixed #9356: Data Form Mail Fields
|
||||
- fixed #9365: Account: when viewing another person's contribution, it displays my name
|
||||
- fixed #9351: Cannot translate phrase
|
||||
- fixed #9368: Gallery: All children included into navigation
|
||||
- fixed #9349: CS archival broken after update (Bernd Kalbfuß-Zimmermann)
|
||||
- fixed Display of Interval form control in Thingy and User profiling did not show units, only seconds.
|
||||
- fixed #9374: Subscription Asset: Redeem subscription template not documented, or user selectable
|
||||
- fixed #9366: Gallery: Missing i18n
|
||||
- fixed #9367: Gallery: Errors in templates
|
||||
- fixed #9352: Account activation message MIA
|
||||
- fixed #9046: Wiki tabs all combined (David Delikat)
|
||||
- refixed #9147: Misspellings in Account
|
||||
- fixed #9348: Required Upgrade Step Not Documented - 7.6.0
|
||||
- fixed #8993: Gallery Image Details Overlap Image
|
||||
- fixed #9380: CoolMenus template - invalid markup affecting page layouts
|
||||
- fixed #9387: Asset Manager breaks navigating into a Gallery Album
|
||||
- fixed #9001: Thingy add image broken
|
||||
- fixed #9386: Gallery: "Image resolutions" issue
|
||||
- fixed #9342: Thingy - Cannot edit a thing
|
||||
- fixed #9033: Deleting Linked Thing Field Crashes Thingy
|
||||
- fixed #9400: Form.captcha should be form_capcha in dataform help
|
||||
- fixed #9402: i18n confusion
|
||||
- fixed #9403: i18n survey
|
||||
- fixed: Syndicated Content corrupts wide characters
|
||||
|
||||
7.6.7
|
||||
- fixed #9263: Thingy possibleValues processing, and List type autodetection.
|
||||
- fixed: Alter WebGUI::Asset::Template's update method so that it can import packages that use the old, deprecated headBlock property. The update method change is deprecatd.
|
||||
|
|
@ -7,8 +43,19 @@
|
|||
- fixed #4124: Site starter uses floats in ways that cause problems
|
||||
- fixed #9274: AdminBar errors and fails when an asset class cannot be loaded
|
||||
- fixed #9301: Error in Shelf Template
|
||||
- fixed #9260: untitled (Delete icon "X" circumvents revision control)
|
||||
- fixed: Deleting an LDAP connection does not take you back to the List LDAP connections screen.
|
||||
- fixed #9284: User manager broken if no LDAP links exits
|
||||
- fixed #4136: Shortcut doesn't display all properties in override
|
||||
- fixed #8838: Gallery Cross Publish template is broken
|
||||
- fixed #8898: versioning problem
|
||||
- fixed #9315: Password Recovery
|
||||
- fixed #9298: Inconsistent date formats
|
||||
- fixed #9296: Thingy View template not recognising field_isVisible (SDH Consulting Group)
|
||||
- fixed #4196: update button doesn't work in IE
|
||||
|
||||
7.6.6
|
||||
- fixed #9217: Survey 2.0 - "Cancel" button not working as expected(David Delikat)
|
||||
- fixed #8792: Image Preview gives ERROR in Collateral Manager
|
||||
- fixed #8774: Forum Rich Edit no longer supports indent/outdent
|
||||
- fixed #4173: fieldnames in profilefields can contain spaces
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -7,6 +7,13 @@ 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.6.8
|
||||
--------------------------------------------------------------------
|
||||
* Due to an error during the 7.6.6 development cycle, an Itransact template,
|
||||
for displaying the credentials screen, needs to be reimported. Any changes
|
||||
that you have made to this module will be lost, so please make a back up
|
||||
of this template.
|
||||
|
||||
7.6.5
|
||||
--------------------------------------------------------------------
|
||||
* The deprecated use of Graphics::Magick has been eliminated. WebGUI uses
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
BIN
docs/upgrades/packages-7.6.7/default-tt-template-row.wgpkg
Normal file
BIN
docs/upgrades/packages-7.6.7/default-tt-template-row.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.
BIN
docs/upgrades/packages-7.6.7/stockdatatmpl000000001.wgpkg
Normal file
BIN
docs/upgrades/packages-7.6.7/stockdatatmpl000000001.wgpkg
Normal file
Binary file not shown.
BIN
docs/upgrades/packages-7.6.8/admin_console.wgpkg
Normal file
BIN
docs/upgrades/packages-7.6.8/admin_console.wgpkg
Normal file
Binary file not shown.
Binary file not shown.
BIN
docs/upgrades/packages-7.6.8/data_list.wgpkg
Normal file
BIN
docs/upgrades/packages-7.6.8/data_list.wgpkg
Normal file
Binary file not shown.
BIN
docs/upgrades/packages-7.6.8/default-pm-resource-popup.wgpkg
Normal file
BIN
docs/upgrades/packages-7.6.8/default-pm-resource-popup.wgpkg
Normal file
Binary file not shown.
BIN
docs/upgrades/packages-7.6.8/default-pm-template-dashboard.wgpkg
Normal file
BIN
docs/upgrades/packages-7.6.8/default-pm-template-dashboard.wgpkg
Normal file
Binary file not shown.
BIN
docs/upgrades/packages-7.6.8/default-wiki-page.wgpkg
Normal file
BIN
docs/upgrades/packages-7.6.8/default-wiki-page.wgpkg
Normal file
Binary file not shown.
BIN
docs/upgrades/packages-7.6.8/default_forum_notification.wgpkg
Normal file
BIN
docs/upgrades/packages-7.6.8/default_forum_notification.wgpkg
Normal file
Binary file not shown.
BIN
docs/upgrades/packages-7.6.8/default_http_proxy.wgpkg
Normal file
BIN
docs/upgrades/packages-7.6.8/default_http_proxy.wgpkg
Normal file
Binary file not shown.
BIN
docs/upgrades/packages-7.6.8/default_post_received.wgpkg
Normal file
BIN
docs/upgrades/packages-7.6.8/default_post_received.wgpkg
Normal file
Binary file not shown.
BIN
docs/upgrades/packages-7.6.8/default_sql_report.wgpkg
Normal file
BIN
docs/upgrades/packages-7.6.8/default_sql_report.wgpkg
Normal file
Binary file not shown.
BIN
docs/upgrades/packages-7.6.8/dropmenu.wgpkg
Normal file
BIN
docs/upgrades/packages-7.6.8/dropmenu.wgpkg
Normal file
Binary file not shown.
BIN
docs/upgrades/packages-7.6.8/job.wgpkg
Normal file
BIN
docs/upgrades/packages-7.6.8/job.wgpkg
Normal file
Binary file not shown.
BIN
docs/upgrades/packages-7.6.8/link.wgpkg
Normal file
BIN
docs/upgrades/packages-7.6.8/link.wgpkg
Normal file
Binary file not shown.
Binary file not shown.
BIN
docs/upgrades/packages-7.6.8/multisearchtmpl0000001.wgpkg
Normal file
BIN
docs/upgrades/packages-7.6.8/multisearchtmpl0000001.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.
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.
Binary file not shown.
Binary file not shown.
BIN
docs/upgrades/packages-7.6.8/stockdatatmpl000000002.wgpkg
Normal file
BIN
docs/upgrades/packages-7.6.8/stockdatatmpl000000002.wgpkg
Normal file
Binary file not shown.
BIN
docs/upgrades/packages-7.6.8/syndicated_articles.wgpkg
Normal file
BIN
docs/upgrades/packages-7.6.8/syndicated_articles.wgpkg
Normal file
Binary file not shown.
|
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
195
docs/upgrades/upgrade_7.6.7-7.6.8.pl
Normal file
195
docs/upgrades/upgrade_7.6.7-7.6.8.pl
Normal file
|
|
@ -0,0 +1,195 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# 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
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
our ($webguiRoot);
|
||||
|
||||
BEGIN {
|
||||
$webguiRoot = "../..";
|
||||
unshift (@INC, $webguiRoot."/lib");
|
||||
}
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Storage;
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::Asset::File::GalleryFile;
|
||||
use WebGUI::Shop::Pay;
|
||||
use WebGUI::Shop::PayDriver;
|
||||
|
||||
|
||||
my $toVersion = '7.6.8';
|
||||
my $quiet; # this line required
|
||||
|
||||
|
||||
my $session = start(); # this line required
|
||||
|
||||
# upgrade functions go here
|
||||
setDefaultItransactCredentialTemplate($session);
|
||||
hideGalleryPhotos($session);
|
||||
addSubscriptionRedeemTemplateSetting($session);
|
||||
reFixAccountMisspellings($session);
|
||||
finish($session); # this line required
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Describe what our function does
|
||||
sub setDefaultItransactCredentialTemplate {
|
||||
my $session = shift;
|
||||
print "\tSet default ITransact Credentials template if it is not set... " unless $quiet;
|
||||
# and here's our code
|
||||
my $pay = WebGUI::Shop::Pay->new($session);
|
||||
my $drivers = $pay->getPaymentGateways($session);
|
||||
DRIVER: foreach my $driver (@{ $drivers }) {
|
||||
##Only work on ITransact drivers
|
||||
next DRIVER unless $driver->className eq "WebGUI::Shop::PayDriver::ITransact";
|
||||
my $properties = $driver->get();
|
||||
##And only ones that don't already have a template set
|
||||
next DRIVER if $properties->{credentialsTemplateId};
|
||||
$properties->{credentialsTemplateId} = 'itransact_credentials1';
|
||||
$driver->update($properties);
|
||||
}
|
||||
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Describe what our function does
|
||||
sub addSubscriptionRedeemTemplateSetting {
|
||||
my $session = shift;
|
||||
print "\tAdd a field to the Subscription Asset so the user can select which Redeem Subscription code template to use... " unless $quiet;
|
||||
# and here's our code
|
||||
$session->db->write(<<EOSQL);
|
||||
alter table Subscription add column redeemSubscriptionCodeTemplateId char(22) NOT NULL default ''
|
||||
EOSQL
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Describe what our function does
|
||||
sub hideGalleryPhotos {
|
||||
my $session = shift;
|
||||
print "\tSet the isHidden bit in all Photos so your navigations do not blow up... " unless $quiet;
|
||||
# and here's our code
|
||||
my $getAPhoto = WebGUI::Asset::File::GalleryFile->getIsa($session);
|
||||
while (my $photo = $getAPhoto->()) {
|
||||
$photo->update({isHidden => 1});
|
||||
}
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
#Describe what our function does
|
||||
sub reFixAccountMisspellings {
|
||||
my $session = shift;
|
||||
my $setting = $session->setting;
|
||||
print "\tFix misspellings in Account settings... " unless $quiet;
|
||||
# and here's our code
|
||||
$setting->add("profileViewTemplateId", $setting->get('profileViewTempalteId') );
|
||||
$setting->add("profileErrorTemplateId", $setting->get('profileErrorTempalteId') );
|
||||
$setting->add("inboxLayoutTemplateId", $setting->get('inboxLayoutTempalteId') );
|
||||
$setting->add("friendsLayoutTemplateId", $setting->get('friendsLayoutTempalteId'));
|
||||
$setting->remove("profileViewTempalteId");
|
||||
$setting->remove("profileErrorTempalteId");
|
||||
$setting->remove("inboxLayoutTempalteId");
|
||||
$setting->remove("friendsLayoutTempalteId");
|
||||
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
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package WebGUI;
|
||||
|
||||
|
||||
our $VERSION = '7.6.7';
|
||||
our $VERSION = '7.6.8';
|
||||
our $STATUS = "beta";
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -176,6 +176,7 @@ sub www_view {
|
|||
'WebGUI::Asset::Post',
|
||||
'WebGUI::Asset::Wobject::GalleryAlbum',
|
||||
'WebGUI::Asset::Event',
|
||||
'WebGUI::Asset::WikiPage',
|
||||
'WebGUI::Asset::Post::Thread',
|
||||
],
|
||||
whereClause => "asset.createdBy = '$userId' or assetData.ownerUserId = '$userId'",
|
||||
|
|
@ -216,6 +217,12 @@ sub www_view {
|
|||
$self->appendCommonVars($var);
|
||||
$p->appendTemplateVars($var);
|
||||
|
||||
#Overwrite these
|
||||
my $user = WebGUI::User->new($session,$userId);
|
||||
$var->{'user_full_name' } = $user->getWholeName;
|
||||
$var->{'user_member_since' } = $user->dateCreated;
|
||||
|
||||
|
||||
return $self->processTemplate($var,$self->getViewTemplateId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -173,6 +173,7 @@ sub www_managePurchases {
|
|||
my $url = $session->url;
|
||||
|
||||
my $var = {};
|
||||
$var->{transactions} = [];
|
||||
|
||||
# build list
|
||||
foreach my $id (@{WebGUI::Shop::Transaction->getTransactionIdsForUser($session)}) {
|
||||
|
|
|
|||
|
|
@ -2573,7 +2573,9 @@ NOTE: Don't try to override or overload this method. It won't work. What you are
|
|||
|
||||
sub www_editSave {
|
||||
my $self = shift;
|
||||
return $self->session->privilege->locked() unless $self->canEditIfLocked;
|
||||
##If this is a new asset (www_add), the parent may be locked. We should still be able to add a new asset.
|
||||
my $isNewAsset = $self->session->form->process("assetId") eq "new" ? 1 : 0;
|
||||
return $self->session->privilege->locked() if (!$self->canEditIfLocked and !$isNewAsset);
|
||||
return $self->session->privilege->insufficient() unless $self->canEdit;
|
||||
if ($self->session->config("maximumAssets")) {
|
||||
my ($count) = $self->session->db->quickArray("select count(*) from asset");
|
||||
|
|
@ -2581,7 +2583,7 @@ sub www_editSave {
|
|||
return $self->session->style->userStyle($i18n->get("over max assets")) if ($self->session->config("maximumAssets") <= $count);
|
||||
}
|
||||
my $object;
|
||||
if ($self->session->form->process("assetId") eq "new") {
|
||||
if ($isNewAsset) {
|
||||
$object = $self->addChild({className=>$self->session->form->process("class","className")});
|
||||
return $self->www_view unless defined $object;
|
||||
$object->{_parent} = $self;
|
||||
|
|
@ -2626,7 +2628,12 @@ sub www_editSave {
|
|||
|
||||
# Handle "saveAndReturn" button
|
||||
if ( $self->session->form->process( "saveAndReturn" ) ne "" ) {
|
||||
return $self->www_edit;
|
||||
if ($isNewAsset) {
|
||||
return $object->www_edit;
|
||||
}
|
||||
else {
|
||||
return $self->www_edit;
|
||||
}
|
||||
}
|
||||
|
||||
# Handle "proceed" form parameter
|
||||
|
|
|
|||
|
|
@ -141,10 +141,11 @@ sub appendTemplateVarsCommentForm {
|
|||
value => $comment->{ bodyText },
|
||||
});
|
||||
|
||||
my $i18n = WebGUI::International->new($session, 'Asset_Photo');
|
||||
$var->{ commentForm_submit }
|
||||
= WebGUI::Form::submit( $session, {
|
||||
name => "submit",
|
||||
value => "Save Comment",
|
||||
value => $i18n->get('form comment save comment'),
|
||||
});
|
||||
|
||||
return $var;
|
||||
|
|
@ -739,6 +740,21 @@ sub setComment {
|
|||
);
|
||||
}
|
||||
|
||||
####################################################################
|
||||
|
||||
=head2 update
|
||||
|
||||
Wrap update so that isHidden is always set to be a 1.
|
||||
|
||||
=cut
|
||||
|
||||
sub update {
|
||||
my $self = shift;
|
||||
my $properties = shift;
|
||||
return $self->SUPER::update({%$properties, isHidden => 1});
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 view ( )
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ use Image::ExifTool qw( :Public );
|
|||
use JSON qw/ encode_json decode_json /;
|
||||
use URI::Escape;
|
||||
use Tie::IxHash;
|
||||
use List::MoreUtils;
|
||||
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::Friends;
|
||||
|
|
@ -360,14 +361,19 @@ sub makeResolutions {
|
|||
my $storage = $self->getStorageLocation;
|
||||
$self->session->errorHandler->info(" Making resolutions for '" . $self->get("filename") . q{'});
|
||||
|
||||
for my $res ( @$resolutions ) {
|
||||
my $filename = $self->get('filename');
|
||||
RESOLUTION: for my $res ( @$resolutions ) {
|
||||
# carp if resolution is bad
|
||||
if ( $res !~ /^\d+$/ && $res !~ /^\d*x\d*/ ) {
|
||||
carp "Geometry '$res' is invalid. Skipping.";
|
||||
next;
|
||||
next RESOLUTION;
|
||||
}
|
||||
##Only resize images if the image is too big!
|
||||
my ($imageX, $imageY) = $storage->getSizeInPixels($filename);
|
||||
my @resolutions = split /x/, $res;
|
||||
next RESOLUTION if List::MoreUtils::any { $imageX < $_ && $imageY < $_ } @resolutions;
|
||||
my $newFilename = $res . ".jpg";
|
||||
$storage->copyFile( $self->get("filename"), $newFilename );
|
||||
$storage->copyFile( $filename, $newFilename );
|
||||
$storage->resize( $newFilename, $res, undef, $self->getGallery->get( 'imageDensity' ) );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -955,6 +955,14 @@ sub postProcess {
|
|||
my $self = shift;
|
||||
my %data = ();
|
||||
($data{synopsis}, $data{content}) = $self->getSynopsisAndContent($self->get("synopsis"), $self->get("content"));
|
||||
my $spamStopWords = $self->session->config->get('spamStopWords');
|
||||
if (ref $spamStopWords eq 'ARRAY') {
|
||||
my $spamRegex = join('|',@{$spamStopWords});
|
||||
if ($data{content} =~ m/$spamRegex/xmsi) {
|
||||
$data{skipNotification} = 1;
|
||||
$self->trash;
|
||||
}
|
||||
}
|
||||
my $user = WebGUI::User->new($self->session, $self->get("ownerUserId"));
|
||||
my $i18n = WebGUI::International->new($self->session, "Asset_Post");
|
||||
if ($self->getThread->getParent->get("addEditStampToPosts")) {
|
||||
|
|
@ -1428,7 +1436,7 @@ sub www_edit {
|
|||
name=>"storageId",
|
||||
value=>$self->get("storageId"),
|
||||
maxAttachments=>$numberOfAttachments,
|
||||
deleteFileUrl=>$self->getUrl("func=deleteFile;filename=")
|
||||
##Removed deleteFileUrl, since it will go around the revision control system.
|
||||
}) if ($numberOfAttachments);
|
||||
|
||||
$var{'contentType.form'} = WebGUI::Form::contentType($session, {
|
||||
|
|
|
|||
|
|
@ -99,6 +99,14 @@ sub definition {
|
|||
label => $i18n->get("template"),
|
||||
hoverHelp => $i18n->get("template help"),
|
||||
},
|
||||
redeemSubscriptionCodeTemplateId => {
|
||||
tab => "display",
|
||||
fieldType => "template",
|
||||
namespace => "Operation/RedeemSubscription",
|
||||
defaultValue => 'PBtmpl0000000000000053',
|
||||
label => $i18n->get("redeem subscription code template"),
|
||||
hoverHelp => $i18n->get("redeem subscription code template help"),
|
||||
},
|
||||
thankYouMessage => {
|
||||
tab => "properties",
|
||||
defaultValue => $i18n->get("default thank you message"),
|
||||
|
|
@ -980,7 +988,7 @@ sub www_redeemSubscriptionCode {
|
|||
$f->submit;
|
||||
$var->{ codeForm } = $f->print;
|
||||
|
||||
return $self->processStyle($self->processTemplate($var, 'PBtmpl0000000000000053'));
|
||||
return $self->processStyle($self->processTemplate($var, $self->get('redeemSubscriptionCodeTemplateId')));
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -584,26 +584,31 @@ sub getEditForm {
|
|||
|
||||
</script>
|
||||
ENDJS
|
||||
|
||||
|
||||
$tab->raw(<<'ENDHTML');
|
||||
<label for="addFeed">Add a feed</label>
|
||||
|
||||
|
||||
my $addFeed = $i18n->get('Add a feed');
|
||||
my $add = $i18n->get('Add');
|
||||
my $feedUrl = $i18n->get('Feed URL');
|
||||
my $status = $i18n->get('434', 'WebGUI');
|
||||
my $lastUpdated = $i18n->get('454', 'WebGUI');
|
||||
$tab->raw(<<"ENDHTML");
|
||||
<label for="addFeed">$addFeed</label>
|
||||
<input type="text" size="60" id="addFeed" name="addFeed" value="" />
|
||||
<input type="button" value="Add" onclick="FeedsManager.addFeed('feeds','new',{ 'url' : this.form.addFeed.value }); this.form.addFeed.value=''" />
|
||||
<input type="button" value="$add" onclick="FeedsManager.addFeed('feeds','new',{ 'url' : this.form.addFeed.value }); this.form.addFeed.value=''" />
|
||||
|
||||
<table id="feeds" style="width: 100%;">
|
||||
<thead>
|
||||
<th style="width: 30px;"> </th>
|
||||
<th style="width: 50%;">Feed URL</th>
|
||||
<th>Status</th>
|
||||
<th>Last Updated</th>
|
||||
<th style="width: 50%;">$feedUrl</th>
|
||||
<th>$status</th>
|
||||
<th>$lastUpdated</th>
|
||||
<th> </th>
|
||||
</thead>
|
||||
</table>
|
||||
ENDHTML
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Add the existing feeds
|
||||
my $feeds = $self->getFeeds();
|
||||
$tab->raw('<script type="text/javascript">'."\n");
|
||||
|
|
@ -612,8 +617,8 @@ ENDHTML
|
|||
$tab->raw("FeedsManager.addFeed('feeds','".$feedId."',".JSON->new->encode( \%row ).");\n");
|
||||
}
|
||||
$tab->raw('</script>');
|
||||
|
||||
|
||||
|
||||
|
||||
$tab->raw("</td></tr>");
|
||||
return $form;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1164,18 +1164,21 @@ sub www_editField {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_editFieldSave {
|
||||
my $self = shift;
|
||||
return $self->session->privilege->insufficient
|
||||
my $session = $self->session;
|
||||
return $session->privilege->insufficient
|
||||
unless $self->canEdit;
|
||||
my $form = $self->session->form;
|
||||
my $form = $session->form;
|
||||
my $fieldName = $form->process('fieldName');
|
||||
my $newName = $self->session->url->urlize($form->process('newName') || $form->process('label'));
|
||||
my $newName = $session->url->urlize($form->process('newName') || $form->process('label'));
|
||||
$newName =~ tr{-/}{};
|
||||
|
||||
# Make sure we don't rename special fields
|
||||
my $isMailField = 0;
|
||||
if ($fieldName) {
|
||||
my $field = $self->getFieldConfig($fieldName);
|
||||
if ($field->{isMailField}) {
|
||||
$newName = $fieldName;
|
||||
$isMailField = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1202,6 +1205,9 @@ sub www_editFieldSave {
|
|||
vertical => $form->process("vertical", 'yesNo'),
|
||||
extras => $form->process("extras"),
|
||||
);
|
||||
if ($isMailField) {
|
||||
$field{isMailField} = 1;
|
||||
}
|
||||
|
||||
my $newSelf = $self->addRevision;
|
||||
if ($fieldName) {
|
||||
|
|
|
|||
|
|
@ -346,7 +346,7 @@ sub DESTROY {
|
|||
my $self = shift;
|
||||
for my $key ( qw/ _nextAlbum _prevAlbum / ) {
|
||||
my $asset = delete $self->{ $key };
|
||||
$asset->DESTROY;
|
||||
$asset->DESTROY if $asset;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -881,6 +881,8 @@ sub www_addArchive {
|
|||
my $form = $self->session->form;
|
||||
my $var = $self->getTemplateVars;
|
||||
|
||||
my $i18n = WebGUI::International->new($session);
|
||||
|
||||
$var->{ error } = $params->{ error };
|
||||
|
||||
$var->{ form_start }
|
||||
|
|
@ -893,7 +895,7 @@ sub www_addArchive {
|
|||
$var->{ form_submit }
|
||||
= WebGUI::Form::submit( $session, {
|
||||
name => "submit",
|
||||
value => "Submit",
|
||||
value => $i18n->get("submit",'WebGUI'),
|
||||
});
|
||||
|
||||
$var->{ form_archive }
|
||||
|
|
|
|||
|
|
@ -1021,6 +1021,7 @@ sub www_getCompareListData {
|
|||
my $self = shift;
|
||||
my @listingIds = @_;
|
||||
my $session = $self->session;
|
||||
my $i18n = WebGUI::International->new($session,'Asset_Matrix');
|
||||
my (@results,@columnDefs);
|
||||
|
||||
unless (scalar(@listingIds)) {
|
||||
|
|
@ -1034,10 +1035,16 @@ sub www_getCompareListData {
|
|||
$listing->incrementCounter("compares");
|
||||
my $listingId_safe = $listingId;
|
||||
$listingId_safe =~ s/-/_____/g;
|
||||
push(@columnDefs,{key=>$listingId_safe,label=>$listing->get('title'),formatter=>"formatColors",
|
||||
url=>$listing->getUrl});
|
||||
push(@columnDefs,{
|
||||
key =>$listingId_safe,
|
||||
label =>$listing->get('title').' '.$listing->get('version'),
|
||||
formatter =>"formatColors",
|
||||
url =>$listing->getUrl,
|
||||
lastUpdated =>$session->datetime->epochToHuman( $listing->get('revisonDate'),"%z" ),
|
||||
});
|
||||
}
|
||||
|
||||
push(@results,{name=>$i18n->get('last updated label'),fieldType=>'lastUpdated'});
|
||||
|
||||
my $jsonOutput;
|
||||
$jsonOutput->{ColumnDefs} = \@columnDefs;
|
||||
|
||||
|
|
@ -1061,10 +1068,16 @@ sub www_getCompareListData {
|
|||
}
|
||||
foreach my $result (@results){
|
||||
if($result->{fieldType} eq 'category'){
|
||||
# Row starting with a category label shows the listing name in each column
|
||||
foreach my $columnDef (@columnDefs) {
|
||||
$result->{$columnDef->{key}} = $columnDef->{label};
|
||||
}
|
||||
}
|
||||
elsif($result->{fieldType} eq 'lastUpdated'){
|
||||
foreach my $columnDef (@columnDefs) {
|
||||
$result->{$columnDef->{key}} = $columnDef->{lastUpdated};
|
||||
}
|
||||
}
|
||||
else{
|
||||
foreach my $listingId (@listingIds) {
|
||||
$result->{attributeId} =~ s/-/_____/g;
|
||||
|
|
|
|||
|
|
@ -405,10 +405,6 @@ sub view {
|
|||
my $previousPageData = undef;
|
||||
my $eh = $self->session->errorHandler;
|
||||
foreach my $asset (@{$assets}) {
|
||||
# Set absoluteDepthOfFirstPage
|
||||
if ( !defined $absoluteDepthOfFirstPage ) {
|
||||
$absoluteDepthOfFirstPage = $asset->getLineageLength;
|
||||
}
|
||||
|
||||
# skip pages we shouldn't see
|
||||
my $pageLineage = $asset->get("lineage");
|
||||
|
|
@ -426,6 +422,13 @@ sub view {
|
|||
$lineageToSkip = $pageLineage unless ($pageLineage eq "000001");
|
||||
next;
|
||||
}
|
||||
|
||||
# Set absoluteDepthOfFirstPage after we have determined if the first page is viewable!
|
||||
# Otherwise, the indent loop calculation below will be off by 1 (or more)
|
||||
if ( !defined $absoluteDepthOfFirstPage ) {
|
||||
$absoluteDepthOfFirstPage = $asset->getLineageLength;
|
||||
}
|
||||
|
||||
my $pageData = {};
|
||||
my $pageProperties = $asset->get;
|
||||
while (my ($property, $propertyValue) = each %{ $pageProperties }) {
|
||||
|
|
|
|||
|
|
@ -27,170 +27,196 @@ our @ISA = qw(WebGUI::Asset::Wobject);
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $definition = shift;
|
||||
my $i18n = WebGUI::International->new($session,"Asset_SQLReport");
|
||||
push(@{$definition}, {
|
||||
assetName=>$i18n->get('assetName'),
|
||||
uiLevel => 5,
|
||||
icon=>'sqlReport.gif',
|
||||
tableName=>'SQLReport',
|
||||
className=>'WebGUI::Asset::Wobject::SQLReport',
|
||||
properties=>{
|
||||
templateId =>{
|
||||
fieldType=>"template",
|
||||
defaultValue=>'PBtmpl0000000000000059'
|
||||
},
|
||||
cacheTimeout=>{
|
||||
fieldType=>"interval",
|
||||
defaultValue=>0
|
||||
},
|
||||
paginateAfter=>{
|
||||
fieldType=>"integer",
|
||||
defaultValue=>50
|
||||
},
|
||||
dbQuery1=>{
|
||||
fieldType=>"codearea",
|
||||
syntax => "sql",
|
||||
defaultValue=>undef,
|
||||
},
|
||||
prequeryStatements1=>{
|
||||
fieldType=>"codearea",
|
||||
syntax => "sql",
|
||||
defaultValue=>undef
|
||||
},
|
||||
preprocessMacros1=>{
|
||||
fieldType=>"yesNo",
|
||||
defaultValue=>0
|
||||
},
|
||||
placeholderParams1=>{
|
||||
fieldType=>"textarea",
|
||||
defaultValue=>undef
|
||||
},
|
||||
databaseLinkId1=>{
|
||||
fieldType=>"databaseLink",
|
||||
defaultValue=>0
|
||||
},
|
||||
dbQuery2=>{
|
||||
fieldType=>"codearea",
|
||||
syntax => "sql",
|
||||
defaultValue=>undef
|
||||
},
|
||||
prequeryStatements2=>{
|
||||
fieldType=>"codearea",
|
||||
syntax => "sql",
|
||||
defaultValue=>undef
|
||||
},
|
||||
preprocessMacros2=>{
|
||||
fieldType=>"yesNo",
|
||||
defaultValue=>0
|
||||
},
|
||||
placeholderParams2=>{
|
||||
fieldType=>"textarea",
|
||||
defaultValue=>undef
|
||||
},
|
||||
databaseLinkId2=>{
|
||||
fieldType=>"databaseLink",
|
||||
defaultValue=>0
|
||||
},
|
||||
dbQuery3=>{
|
||||
fieldType=>"codearea",
|
||||
syntax => "sql",
|
||||
defaultValue=>undef
|
||||
},
|
||||
prequeryStatements3=>{
|
||||
fieldType=>"codearea",
|
||||
syntax => "sql",
|
||||
defaultValue=>undef
|
||||
},
|
||||
preprocessMacros3=>{
|
||||
fieldType=>"yesNo",
|
||||
defaultValue=>0
|
||||
},
|
||||
placeholderParams3=>{
|
||||
fieldType=>"textarea",
|
||||
defaultValue=>undef
|
||||
},
|
||||
databaseLinkId3=>{
|
||||
fieldType=>"databaseLink",
|
||||
defaultValue=>0
|
||||
},
|
||||
dbQuery4=>{
|
||||
fieldType=>"codearea",
|
||||
syntax => "sql",
|
||||
defaultValue=>undef
|
||||
},
|
||||
prequeryStatements4=>{
|
||||
fieldType=>"codearea",
|
||||
syntax => "sql",
|
||||
defaultValue=>undef
|
||||
},
|
||||
preprocessMacros4=>{
|
||||
fieldType=>"yesNo",
|
||||
defaultValue=>0
|
||||
},
|
||||
placeholderParams4=>{
|
||||
fieldType=>"textarea",
|
||||
defaultValue=>undef
|
||||
},
|
||||
databaseLinkId4=>{
|
||||
fieldType=>"databaseLink",
|
||||
defaultValue=>0
|
||||
},
|
||||
dbQuery5=>{
|
||||
fieldType=>"codearea",
|
||||
syntax => "sql",
|
||||
defaultValue=>undef
|
||||
},
|
||||
prequeryStatements5=>{
|
||||
fieldType=>"codearea",
|
||||
syntax => "sql",
|
||||
defaultValue=>undef
|
||||
},
|
||||
preprocessMacros5=>{
|
||||
fieldType=>"yesNo",
|
||||
defaultValue=>0
|
||||
},
|
||||
placeholderParams5=>{
|
||||
fieldType=>"textarea",
|
||||
defaultValue=>undef
|
||||
},
|
||||
databaseLinkId5=>{
|
||||
fieldType=>"databaseLink",
|
||||
defaultValue=>0
|
||||
},
|
||||
debugMode=>{
|
||||
fieldType=>"yesNo",
|
||||
defaultValue=>0
|
||||
},
|
||||
|
||||
# download
|
||||
downloadType=>{
|
||||
fieldType=>"text",
|
||||
defaultValue=>"none",
|
||||
},
|
||||
downloadFilename=>{
|
||||
fieldType=>"text",
|
||||
defaultValue=>"",
|
||||
},
|
||||
downloadTemplateId=>{
|
||||
fieldType=>"template",
|
||||
defaultValue=>'SQLReportDownload00001',
|
||||
},
|
||||
downloadMimeType=>{
|
||||
fieldType=>"text",
|
||||
defaultValue=>"text/html",
|
||||
},
|
||||
downloadUserGroup=>{
|
||||
fieldType=>"group",
|
||||
defaultValue=>"text/html",
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
return $class->SUPER::definition($session, $definition);
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $definition = shift;
|
||||
my $i18n = WebGUI::International->new($session,"Asset_SQLReport");
|
||||
my %properties;
|
||||
tie %properties, 'Tie::IxHash';
|
||||
%properties = (
|
||||
templateId =>{
|
||||
fieldType=>"template",
|
||||
defaultValue=>'PBtmpl0000000000000059',
|
||||
label=>$i18n->get(72),
|
||||
},
|
||||
cacheTimeout=>{
|
||||
fieldType=>"interval",
|
||||
defaultValue=>0,
|
||||
label=>$i18n->get('cache timeout'),
|
||||
},
|
||||
paginateAfter=>{
|
||||
fieldType=>"integer",
|
||||
defaultValue=>50,
|
||||
label=>$i18n->get(14),
|
||||
},
|
||||
dbQuery1=>{
|
||||
fieldType=>"codearea",
|
||||
defaultValue=>undef,
|
||||
label=>$i18n->get(4) . ' 1',
|
||||
},
|
||||
prequeryStatements1=>{
|
||||
fieldType=>"codearea",
|
||||
defaultValue=>undef,
|
||||
label => $i18n->get('Prequery statements') . ' 1',
|
||||
},
|
||||
preprocessMacros1=>{
|
||||
fieldType=>"yesNo",
|
||||
defaultValue=>0,
|
||||
label=>$i18n->get(15) . ' 1',
|
||||
},
|
||||
placeholderParams1=>{
|
||||
fieldType=>"textarea",
|
||||
defaultValue=>undef,
|
||||
label=>$i18n->get('Placeholder Parameters') . ' 1',
|
||||
},
|
||||
databaseLinkId1=>{
|
||||
fieldType=>"databaseLink",
|
||||
defaultValue=>0,
|
||||
label=>$i18n->get("1075", 'WebGUI').' 1',
|
||||
},
|
||||
dbQuery2=>{
|
||||
fieldType=>"codearea",
|
||||
defaultValue=>undef,
|
||||
label=>$i18n->get(4) . ' 2',
|
||||
},
|
||||
prequeryStatements2=>{
|
||||
fieldType=>"codearea",
|
||||
defaultValue=>undef,
|
||||
label => $i18n->get('Prequery statements') . ' 2',
|
||||
},
|
||||
preprocessMacros2=>{
|
||||
fieldType=>"yesNo",
|
||||
defaultValue=>0,
|
||||
label=>$i18n->get(15) . ' 2',
|
||||
},
|
||||
placeholderParams2=>{
|
||||
fieldType=>"textarea",
|
||||
defaultValue=>undef,
|
||||
label=>$i18n->get('Placeholder Parameters') . ' 2',
|
||||
},
|
||||
databaseLinkId2=>{
|
||||
fieldType=>"databaseLink",
|
||||
defaultValue=>0,
|
||||
label=>$i18n->get("1075", 'WebGUI').' 2',
|
||||
},
|
||||
dbQuery3=>{
|
||||
fieldType=>"codearea",
|
||||
defaultValue=>undef,
|
||||
label=>$i18n->get(4) . ' 3',
|
||||
},
|
||||
prequeryStatements3=>{
|
||||
fieldType=>"codearea",
|
||||
defaultValue=>undef,
|
||||
label => $i18n->get('Prequery statements') . ' 3',
|
||||
},
|
||||
preprocessMacros3=>{
|
||||
fieldType=>"yesNo",
|
||||
defaultValue=>0,
|
||||
label=>$i18n->get(15) . ' 3',
|
||||
},
|
||||
placeholderParams3=>{
|
||||
fieldType=>"textarea",
|
||||
defaultValue=>undef,
|
||||
label=>$i18n->get('Placeholder Parameters') . ' 3',
|
||||
},
|
||||
databaseLinkId3=>{
|
||||
fieldType=>"databaseLink",
|
||||
defaultValue=>0,
|
||||
label=>$i18n->get("1075", 'WebGUI').' 3',
|
||||
},
|
||||
dbQuery4=>{
|
||||
fieldType=>"codearea",
|
||||
defaultValue=>undef,
|
||||
label=>$i18n->get(4) . ' 4',
|
||||
},
|
||||
prequeryStatements4=>{
|
||||
fieldType=>"codearea",
|
||||
defaultValue=>undef,
|
||||
label => $i18n->get('Prequery statements') . ' 4',
|
||||
},
|
||||
preprocessMacros4=>{
|
||||
fieldType=>"yesNo",
|
||||
defaultValue=>0,
|
||||
label=>$i18n->get(15) . ' 4',
|
||||
},
|
||||
placeholderParams4=>{
|
||||
fieldType=>"textarea",
|
||||
defaultValue=>undef,
|
||||
label=>$i18n->get('Placeholder Parameters') . ' 4',
|
||||
},
|
||||
databaseLinkId4=>{
|
||||
fieldType=>"databaseLink",
|
||||
defaultValue=>0,
|
||||
label=>$i18n->get("1075", 'WebGUI').' 4',
|
||||
},
|
||||
dbQuery5=>{
|
||||
fieldType=>"codearea",
|
||||
defaultValue=>undef,
|
||||
label=>$i18n->get(4) . ' 5',
|
||||
},
|
||||
prequeryStatements5=>{
|
||||
fieldType=>"codearea",
|
||||
defaultValue=>undef,
|
||||
label => $i18n->get('Prequery statements') . ' 5',
|
||||
},
|
||||
preprocessMacros5=>{
|
||||
fieldType=>"yesNo",
|
||||
defaultValue=>0,
|
||||
label=>$i18n->get(15) . '5',
|
||||
},
|
||||
placeholderParams5=>{
|
||||
fieldType=>"textarea",
|
||||
defaultValue=>undef,
|
||||
label=>$i18n->get('Placeholder Parameters') . ' 5',
|
||||
},
|
||||
databaseLinkId5=>{
|
||||
fieldType=>"databaseLink",
|
||||
defaultValue=>0,
|
||||
label=>$i18n->get("1075", 'WebGUI').' 5',
|
||||
},
|
||||
debugMode=>{
|
||||
fieldType=>"yesNo",
|
||||
defaultValue=>0,
|
||||
label=>$i18n->get(16),
|
||||
},
|
||||
|
||||
# download
|
||||
downloadType=>{
|
||||
fieldType=>"text",
|
||||
defaultValue=>"none",
|
||||
label=>$i18n->get("download type"),
|
||||
},
|
||||
downloadFilename=>{
|
||||
fieldType=>"text",
|
||||
defaultValue=>"",
|
||||
label=>$i18n->get("download filename"),
|
||||
},
|
||||
downloadTemplateId=>{
|
||||
fieldType=>"template",
|
||||
defaultValue=>'SQLReportDownload00001',
|
||||
label=>$i18n->get("download template"),
|
||||
},
|
||||
downloadMimeType=>{
|
||||
fieldType=>"text",
|
||||
defaultValue=>"text/html",
|
||||
label=>$i18n->get("download mimetype"),
|
||||
},
|
||||
downloadUserGroup=>{
|
||||
fieldType=>"group",
|
||||
defaultValue=>"text/html",
|
||||
label=>$i18n->get("download usergroup"),
|
||||
},
|
||||
);
|
||||
push(@{$definition}, {
|
||||
assetName=>$i18n->get('assetName'),
|
||||
uiLevel => 5,
|
||||
icon=>'sqlReport.gif',
|
||||
tableName=>'SQLReport',
|
||||
className=>'WebGUI::Asset::Wobject::SQLReport',
|
||||
properties => \%properties,
|
||||
autoGenerateForms => 0,
|
||||
});
|
||||
return $class->SUPER::definition($session, $definition);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -39,23 +39,23 @@ sub definition {
|
|||
label => "Template ID"
|
||||
},
|
||||
showProgress => {
|
||||
fieldType => "yesNo",
|
||||
fieldType => "yesNo",
|
||||
defaultValue => 0,
|
||||
tab => 'properties',
|
||||
label => "Show user their progress"
|
||||
tab => 'properties',
|
||||
label => "Show user their progress"
|
||||
},
|
||||
showTimeLimit => {
|
||||
fieldType => "yesNo",
|
||||
fieldType => "yesNo",
|
||||
defaultValue => 0,
|
||||
tab => 'properties',
|
||||
label => "Show user their time remaining"
|
||||
tab => 'properties',
|
||||
label => "Show user their time remaining"
|
||||
},
|
||||
timeLimit => {
|
||||
fieldType => 'integer',
|
||||
timeLimit => {
|
||||
fieldType => 'integer',
|
||||
defaultValue => 0,
|
||||
tab => 'properties',
|
||||
hoverHelp => $i18n->get('timelimit hoverHelp'),
|
||||
label => $i18n->get('timelimit')
|
||||
tab => 'properties',
|
||||
hoverHelp => $i18n->get('timelimit hoverHelp'),
|
||||
label => $i18n->get('timelimit')
|
||||
},
|
||||
groupToEditSurvey => {
|
||||
fieldType => 'group',
|
||||
|
|
@ -260,9 +260,9 @@ Loads the initial edit survey page. All other edit actions are JSON calls from
|
|||
|
||||
sub www_editSurvey {
|
||||
my $self = shift;
|
||||
|
||||
return $self->session->privilege->insufficient()
|
||||
unless ($self->session->user->isInGroup($self->get('groupToEditSurvey')));
|
||||
|
||||
return $self->session->privilege->insufficient()
|
||||
unless ( $self->session->user->isInGroup( $self->get('groupToEditSurvey') ) );
|
||||
|
||||
my %var;
|
||||
my $out = $self->processTemplate( \%var, $self->get("surveyEditTemplateId") );
|
||||
|
|
@ -273,9 +273,9 @@ sub www_editSurvey {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_submitObjectEdit {
|
||||
my $self = shift;
|
||||
|
||||
return $self->session->privilege->insufficient()
|
||||
unless ($self->session->user->isInGroup($self->get('groupToEditSurvey')));
|
||||
|
||||
return $self->session->privilege->insufficient()
|
||||
unless ( $self->session->user->isInGroup( $self->get('groupToEditSurvey') ) );
|
||||
|
||||
# my $ref = @{from_json($self->session->form->process("data"))};
|
||||
my $responses = $self->session->form->paramsHashRef();
|
||||
|
|
@ -299,14 +299,14 @@ sub www_submitObjectEdit {
|
|||
} ## end sub www_submitObjectEdit
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
=head2 Allow survey editors to "jump to" a particular section of question in a
|
||||
=head2 Allow survey editors to "jump to" a particular section of question in a
|
||||
Survey by tricking Survey into thinking they've completed the survey up to that
|
||||
point. Useful for survey builders.
|
||||
Note that calling this method will delete any existing survey responses for the
|
||||
current user (although only survey builders can call this method so that shouldn't be
|
||||
a problem
|
||||
=cut
|
||||
|
||||
|
||||
sub www_jumpTo {
|
||||
my $self = shift;
|
||||
|
||||
|
|
@ -314,7 +314,7 @@ sub www_jumpTo {
|
|||
unless ( $self->session->user->isInGroup( $self->get('groupToEditSurvey') ) );
|
||||
|
||||
my $data = $self->session->form->paramsHashRef();
|
||||
|
||||
|
||||
$self->session->log->debug("jumpTo to $data->{id}");
|
||||
|
||||
# Remove existing responses for current user
|
||||
|
|
@ -387,10 +387,10 @@ sub deleteObject {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_newObject {
|
||||
my $self = shift;
|
||||
|
||||
return $self->session->privilege->insufficient()
|
||||
unless ($self->session->user->isInGroup($self->get('groupToEditSurvey')));
|
||||
|
||||
|
||||
return $self->session->privilege->insufficient()
|
||||
unless ( $self->session->user->isInGroup( $self->get('groupToEditSurvey') ) );
|
||||
|
||||
my $ref;
|
||||
|
||||
my $ids = $self->session->form->process("data");
|
||||
|
|
@ -411,11 +411,11 @@ sub www_newObject {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_dragDrop {
|
||||
my $self = shift;
|
||||
|
||||
return $self->session->privilege->insufficient()
|
||||
unless ($self->session->user->isInGroup($self->get('groupToEditSurvey')));
|
||||
|
||||
my $p = from_json( $self->session->form->process("data") );
|
||||
|
||||
return $self->session->privilege->insufficient()
|
||||
unless ( $self->session->user->isInGroup( $self->get('groupToEditSurvey') ) );
|
||||
|
||||
my $p = from_json( $self->session->form->process("data") );
|
||||
|
||||
my @tid = split /-/, $p->{target}->{id};
|
||||
my @bid = split /-/, $p->{before}->{id};
|
||||
|
|
@ -463,6 +463,7 @@ sub www_dragDrop {
|
|||
$self->survey->insertObject( $target, [ $bid[0], $bid[1], $bid[2] ] );
|
||||
}
|
||||
else {
|
||||
|
||||
#else put it back where it was
|
||||
$self->survey->insertObject( $target, \@tid );
|
||||
}
|
||||
|
|
@ -476,13 +477,19 @@ sub www_dragDrop {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_loadSurvey {
|
||||
my ( $self, $options ) = @_;
|
||||
my $editflag = 1;
|
||||
|
||||
$self->loadSurveyJSON();
|
||||
|
||||
my $address = defined $options->{address} ? $options->{address} : undef;
|
||||
if ( !defined $address ) {
|
||||
if ( my $inAddress = $self->session->form->process("data") ) {
|
||||
$address = [ split /-/, $inAddress ];
|
||||
if( $inAddress eq '-' ) {
|
||||
$editflag = 0;
|
||||
$address = [ 0 ];
|
||||
} else {
|
||||
$address = [ split /-/, $inAddress ];
|
||||
}
|
||||
}
|
||||
else {
|
||||
$address = [0];
|
||||
|
|
@ -504,7 +511,7 @@ sub www_loadSurvey {
|
|||
elsif ( $var->{type} eq 'answer' ) {
|
||||
$editHtml = $self->processTemplate( $var, $self->get("answerEditTemplateId") );
|
||||
}
|
||||
|
||||
|
||||
# Generate the list of valid goto targets
|
||||
my @gotoTargets = $self->survey->getGotoTargets;
|
||||
|
||||
|
|
@ -559,9 +566,10 @@ sub www_loadSurvey {
|
|||
#ids is a list of all ids passed in which are draggable (for adding events)
|
||||
#type is the object type
|
||||
my $return = {
|
||||
"address", $address, "buttons", \%buttons, "edithtml", $editHtml,
|
||||
"ddhtml", $html, "ids", \@ids, "type", $var->{type},
|
||||
gotoTargets => \@gotoTargets,
|
||||
"address", $address, "buttons", \%buttons,
|
||||
"edithtml", $editflag ? $editHtml : '',
|
||||
"ddhtml", $html, "ids", \@ids, "type", $var->{type}
|
||||
,gotoTargets => \@gotoTargets,
|
||||
};
|
||||
$self->session->http->setMimeType('application/json');
|
||||
return to_json($return);
|
||||
|
|
@ -631,19 +639,90 @@ sub view {
|
|||
my $self = shift;
|
||||
my %var;
|
||||
|
||||
$var{'edit_survey_url'} = $self->getUrl('func=editSurvey');
|
||||
$var{'take_survey_url'} = $self->getUrl('func=takeSurvey');
|
||||
$var{'view_simple_results_url'} = $self->getUrl('func=exportSimpleResults');
|
||||
$var{'view_transposed_results_url'} = $self->getUrl('func=exportTransposedResults');
|
||||
$var{'view_statistical_overview_url'} = $self->getUrl('func=viewStatisticalOverview');
|
||||
$var{'view_grade_book_url'} = $self->getUrl('func=viewGradeBook');
|
||||
$var{'user_canTakeSurvey'} = $self->session->user->isInGroup( $self->get("groupToTakeSurvey") );
|
||||
$var{'user_canViewReports'} = $self->session->user->isInGroup( $self->get("groupToViewReports") );
|
||||
$var{'user_canEditSurvey'} = $self->session->user->isInGroup( $self->get("groupToEditSurvey") );
|
||||
$var{'edit_survey_url'} = $self->getUrl('func=editSurvey');
|
||||
$var{'take_survey_url'} = $self->getUrl('func=takeSurvey');
|
||||
$var{'view_simple_results_url'} = $self->getUrl('func=exportSimpleResults');
|
||||
$var{'view_transposed_results_url'} = $self->getUrl('func=exportTransposedResults');
|
||||
$var{'view_statistical_overview_url'} = $self->getUrl('func=viewStatisticalOverview');
|
||||
$var{'view_grade_book_url'} = $self->getUrl('func=viewGradeBook');
|
||||
$var{'user_canTakeSurvey'} = $self->session->user->isInGroup( $self->get("groupToTakeSurvey") );
|
||||
$var{'user_canViewReports'} = $self->session->user->isInGroup( $self->get("groupToViewReports") );
|
||||
$var{'user_canEditSurvey'} = $self->session->user->isInGroup( $self->get("groupToEditSurvey") );
|
||||
$var{'user_canEditSurvey'} = $self->session->user->isInGroup( $self->get("groupToEditSurvey") );
|
||||
my ( $code, $overTakeLimit ) = $self->getResponseInfoForView();
|
||||
$var{'lastResponseCompleted'} = $code;
|
||||
$var{'lastResponseTimedOut'} = $code > 1 ? 1 : 0;
|
||||
$var{'maxResponsesSubmitted'} = $overTakeLimit;
|
||||
my $out = $self->processTemplate( \%var, undef, $self->{_viewTemplate} );
|
||||
|
||||
return $out;
|
||||
}
|
||||
} ## end sub view
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getResponseInfoForView ( )
|
||||
|
||||
Looks to see if this user has a response, looks at the last one to see if it was completed or timed out.
|
||||
Then it checks to see if the user has reached the max number of responses.
|
||||
|
||||
=cut
|
||||
|
||||
sub getResponseInfoForView {
|
||||
my $self = shift;
|
||||
|
||||
my ( $code, $taken );
|
||||
|
||||
my $maxTakes = $self->getValue("maxResponsesPerUser");
|
||||
my $id = $self->session->user->userId();
|
||||
my $anonId
|
||||
= $self->session->form->process("userid")
|
||||
|| $self->session->http->getCookies->{"Survey2AnonId"}
|
||||
|| undef;
|
||||
$self->session->http->setCookie( "Survey2AnonId", $anonId ) if ($anonId);
|
||||
my $ip = $self->session->env->getIp;
|
||||
my $string;
|
||||
|
||||
#if there is an anonid or id is for a WG user
|
||||
if ( $anonId or $id != 1 ) {
|
||||
$string = 'userId';
|
||||
if ($anonId) {
|
||||
$string = 'anonId';
|
||||
$id = $anonId;
|
||||
}
|
||||
my $responseId
|
||||
= $self->session->db->quickScalar(
|
||||
"select Survey_responseId from Survey_response where $string = ? and assetId = ? and isComplete = 0",
|
||||
[ $id, $self->getId() ] );
|
||||
if ( !$responseId ) {
|
||||
$code = $self->session->db->quickScalar(
|
||||
"select isComplete from Survey_response where $string = ? and assetId = ? and isComplete > 0 order by endDate desc limit 1",
|
||||
[ $id, $self->getId() ]
|
||||
);
|
||||
}
|
||||
$taken
|
||||
= $self->session->db->quickScalar(
|
||||
"select count(*) from Survey_response where $string = ? and assetId = ? and isComplete > 0",
|
||||
[ $id, $self->getId() ] );
|
||||
|
||||
} ## end if ( $anonId or $id !=...
|
||||
elsif ( $id == 1 ) {
|
||||
my $responseId = $self->session->db->quickScalar(
|
||||
"select Survey_responseId from Survey_response where userId = ? and ipAddress = ? and assetId = ? and isComplete = 0",
|
||||
[ $id, $ip, $self->getId() ]
|
||||
);
|
||||
if ( !$responseId ) {
|
||||
$code = $self->session->db->quickScalar(
|
||||
"select isComplete from Survey_response where userId = ? and ipAddress = ? and assetId = ? and isComplete > 0 order by endDate desc limit 1",
|
||||
[ $id, $ip, $self->getId() ]
|
||||
);
|
||||
}
|
||||
$taken = $self->session->db->quickScalar(
|
||||
"select count(*) from Survey_response where userId = ? and ipAddress = ? and assetId = ? and isComplete > 0",
|
||||
[ $id, $ip, $self->getId() ]
|
||||
);
|
||||
} ## end elsif ( $id == 1 )
|
||||
return ( $code, $taken >= $maxTakes );
|
||||
} ## end sub getResponseInfoForView
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
@ -667,24 +746,26 @@ sub www_takeSurvey {
|
|||
my $responseId = $self->getResponseId();
|
||||
if ( !$responseId ) {
|
||||
$self->session->log->debug('No responseId, surveyEnd');
|
||||
# return $self->surveyEnd(); # disabled. let the js handle the exitUrl redirection
|
||||
} else {
|
||||
|
||||
# return $self->surveyEnd(); # disabled. let the js handle the exitUrl redirection
|
||||
}
|
||||
else {
|
||||
$self->session->log->debug("ResponseId: $responseId");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
my $out = $self->processTemplate( \%var, $self->get("surveyTakeTemplateId") );
|
||||
return $self->session->style->process($out,$self->get("styleTemplateId"));
|
||||
}
|
||||
return $self->session->style->process( $out, $self->get("styleTemplateId") );
|
||||
} ## end sub www_takeSurvey
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteResponses {
|
||||
my $self = shift;
|
||||
|
||||
return $self->session->privilege->insufficient()
|
||||
unless ($self->session->user->isInGroup($self->get('groupToEditSurvey')));
|
||||
|
||||
$self->session->db->write('delete from Survey_response where assetId = ?',[$self->getId]);
|
||||
|
||||
return $self->session->privilege->insufficient()
|
||||
unless ( $self->session->user->isInGroup( $self->get('groupToEditSurvey') ) );
|
||||
|
||||
$self->session->db->write( 'delete from Survey_response where assetId = ?', [ $self->getId ] );
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -702,7 +783,7 @@ sub www_submitQuestions {
|
|||
my $responseId = $self->getResponseId();
|
||||
if ( !$responseId ) {
|
||||
$self->session->log->debug('No response id, surveyEnd');
|
||||
return $self->surveyEnd();
|
||||
return $self->surveyEnd();
|
||||
}
|
||||
|
||||
my $responses = $self->session->form->paramsHashRef();
|
||||
|
|
@ -712,7 +793,7 @@ sub www_submitQuestions {
|
|||
|
||||
$self->loadBothJSON();
|
||||
|
||||
my $termInfo = $self->response->recordResponses($self->session, $responses);
|
||||
my $termInfo = $self->response->recordResponses( $self->session, $responses );
|
||||
|
||||
$self->saveResponseJSON();
|
||||
|
||||
|
|
@ -770,9 +851,9 @@ sub www_loadQuestions {
|
|||
$self->session->log->debug('No responseId, surveyEnd');
|
||||
return $self->surveyEnd();
|
||||
}
|
||||
if($self->response->hasTimedOut($self->get('timeLimit'))){
|
||||
if ( $self->response->hasTimedOut( $self->get('timeLimit') ) ) {
|
||||
$self->session->log->debug('Response hasTimedOut, surveyEnd');
|
||||
return $self->surveyEnd();
|
||||
return $self->surveyEnd( undef, 2 );
|
||||
}
|
||||
|
||||
if ( $self->response->surveyEnd() ) {
|
||||
|
|
@ -792,19 +873,41 @@ sub www_loadQuestions {
|
|||
} ## end sub www_loadQuestions
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
#called when the survey is over.
|
||||
|
||||
=head2 surveyEnd ( [ $url ], [ $completeCode ] )
|
||||
|
||||
Marks the survey completed with either 1 or the $completeCode and then sends the url to the site home or if defined, $url.
|
||||
|
||||
=head3 $url
|
||||
|
||||
An optional url to send the user to upon survey completion.
|
||||
|
||||
=head3 $completeCode
|
||||
|
||||
An optional code (defaults to 1) to say how the user completed the survey.
|
||||
|
||||
1 is normal completion.
|
||||
2 is timed out.
|
||||
|
||||
=cut
|
||||
|
||||
sub surveyEnd {
|
||||
my $self = shift;
|
||||
my $url = shift;
|
||||
|
||||
if (my $responseId = $self->getResponseId()) { #also loads the survey and response
|
||||
# $self->session->db->write("update Survey_response set endDate = ? and isComplete = 1 where Survey_responseId = ?",[WebGUI::DateTime->now->toDatabase,$responseId]);
|
||||
my $self = shift;
|
||||
my $url = shift;
|
||||
my $completeCode = shift;
|
||||
|
||||
$completeCode = defined $completeCode ? $completeCode : 1;
|
||||
|
||||
if ( my $responseId = $self->getResponseId() ) { #also loads the survey and response
|
||||
# $self->session->db->write("update Survey_response set endDate = ? and isComplete > 0 where Survey_responseId = ?",[WebGUI::DateTime->now->toDatabase,$responseId]);
|
||||
$self->session->db->setRow(
|
||||
"Survey_response",
|
||||
"Survey_responseId", {
|
||||
Survey_responseId => $responseId,
|
||||
endDate => time(),#WebGUI::DateTime->now->toDatabase,
|
||||
isComplete => 1
|
||||
endDate => time(), #WebGUI::DateTime->now->toDatabase,
|
||||
isComplete => $completeCode
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
@ -819,8 +922,9 @@ sub surveyEnd {
|
|||
$url = "/";
|
||||
}
|
||||
}
|
||||
# $self->session->http->setRedirect($url);
|
||||
return to_json({ "type", "forward", "url", $url });
|
||||
|
||||
# $self->session->http->setRedirect($url);
|
||||
return to_json( { "type", "forward", "url", $url } );
|
||||
} ## end sub surveyEnd
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -867,12 +971,13 @@ sub prepareShowSurveyTemplate {
|
|||
$$q{'verte'} = "</p>";
|
||||
}
|
||||
} ## end foreach my $q (@$questions)
|
||||
$section->{'questions'} = $questions;
|
||||
$section->{'questions'} = $questions;
|
||||
$section->{'questionsAnswered'} = $self->response->{questionsAnswered};
|
||||
$section->{'totalQuestions'} = @{$self->response->surveyOrder};
|
||||
$section->{'showProgress'} = $self->get('showProgress');
|
||||
$section->{'showTimeLimit'} = $self->get('showTimeLimit');
|
||||
$section->{'minutesLeft'} = int((($self->response->startTime() + (60 * $self->get('timeLimit'))) - time())/60);
|
||||
$section->{'totalQuestions'} = @{ $self->response->surveyOrder };
|
||||
$section->{'showProgress'} = $self->get('showProgress');
|
||||
$section->{'showTimeLimit'} = $self->get('showTimeLimit');
|
||||
$section->{'minutesLeft'}
|
||||
= int( ( ( $self->response->startTime() + ( 60 * $self->get('timeLimit') ) ) - time() ) / 60 );
|
||||
|
||||
if(scalar @$questions == ($section->{'totalQuestions'} - $section->{'questionsAnswered'})){
|
||||
$section->{isLastPage} = 1
|
||||
|
|
@ -1000,8 +1105,8 @@ sub getResponseId {
|
|||
userId => $id,
|
||||
ipAddress => $ip,
|
||||
username => $self->session->user->username,
|
||||
startDate => $time,#WebGUI::DateTime->now->toDatabase,
|
||||
endDate => 0,#WebGUI::DateTime->now->toDatabase,
|
||||
startDate => $time, #WebGUI::DateTime->now->toDatabase,
|
||||
endDate => 0, #WebGUI::DateTime->now->toDatabase,
|
||||
assetId => $self->getId(),
|
||||
anonId => $anonId
|
||||
}
|
||||
|
|
@ -1010,7 +1115,7 @@ sub getResponseId {
|
|||
$self->response->createSurveyOrder();
|
||||
$self->{responseId} = $responseId;
|
||||
$self->saveResponseJSON();
|
||||
|
||||
|
||||
} ## end if ( $haveTaken < $allowedTakes)
|
||||
else {
|
||||
$self->session->log->debug("haveTaken ($haveTaken) >= allowedTakes ($allowedTakes)");
|
||||
|
|
@ -1041,14 +1146,14 @@ sub canTakeSurvey {
|
|||
if ( $id == 1 ) {
|
||||
$takenCount = $self->session->db->quickScalar(
|
||||
"select count(*) from Survey_response where userId = ? and ipAddress = ? and assetId = ?
|
||||
and isComplete = ?", [ $id, $ip, $self->getId(), 1 ]
|
||||
and isComplete > ?", [ $id, $ip, $self->getId(), 0 ]
|
||||
);
|
||||
}
|
||||
else {
|
||||
$takenCount
|
||||
= $self->session->db->quickScalar(
|
||||
"select count(*) from Survey_response where userId = ? and assetId = ? and isComplete = ?",
|
||||
[ $id, $self->getId(), 1 ] );
|
||||
"select count(*) from Survey_response where userId = ? and assetId = ? and isComplete > ?",
|
||||
[ $id, $self->getId(), 0 ] );
|
||||
}
|
||||
|
||||
if ( $takenCount >= $maxTakes ) {
|
||||
|
|
@ -1060,32 +1165,36 @@ sub canTakeSurvey {
|
|||
return $self->{canTake};
|
||||
|
||||
} ## end sub canTakeSurvey
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_viewGradeBook{
|
||||
sub www_viewGradeBook {
|
||||
my $self = shift;
|
||||
|
||||
return $self->session->privilege->insufficient()
|
||||
|
||||
return $self->session->privilege->insufficient()
|
||||
unless ( $self->session->user->isInGroup( $self->get("groupToViewReports") ) );
|
||||
|
||||
|
||||
$self->loadTempReportTable();
|
||||
|
||||
my @peoples = $self->session->db->quickArray("SELECT UNIQUE(Survey_responseId) from Survey_tempReport where assetId = ?",[$self->getId()]);
|
||||
for my $people(@peoples){
|
||||
|
||||
my @peoples
|
||||
= $self->session->db->quickArray( "SELECT UNIQUE(Survey_responseId) from Survey_tempReport where assetId = ?",
|
||||
[ $self->getId() ] );
|
||||
for my $people (@peoples) {
|
||||
|
||||
#my $
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} ## end sub www_viewGradeBook
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_exportSimpleResults{
|
||||
sub www_exportSimpleResults {
|
||||
my $self = shift;
|
||||
|
||||
return $self->session->privilege->insufficient()
|
||||
|
||||
return $self->session->privilege->insufficient()
|
||||
unless ( $self->session->user->isInGroup( $self->get("groupToViewReports") ) );
|
||||
|
||||
|
||||
$self->loadTempReportTable();
|
||||
|
||||
|
||||
my $filename = $self->session->url->escape( $self->get("title") . "_results.tab" );
|
||||
my $content
|
||||
= $self->session->db->quickTab(
|
||||
|
|
|
|||
|
|
@ -856,7 +856,7 @@ Logs an error to the webgui log file, using the session logger.
|
|||
sub log {
|
||||
my ( $self, $message) = @_;
|
||||
if ( defined $self->{log} ) {
|
||||
$self->{log}->error($message);
|
||||
$self->{log}->debug($message);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -320,10 +320,10 @@ sub getSectionEditVars {
|
|||
|
||||
sub getGotoTargets {
|
||||
my $self = shift;
|
||||
|
||||
|
||||
my @section_vars = map {$_->{variable}} @{$self->sections};
|
||||
my @question_vars = map {$_->{variable}} @{$self->questions};
|
||||
return grep {$_ ne ''} (@section_vars, @question_vars);
|
||||
return grep {$_ ne ''} (@section_vars, @question_vars);
|
||||
}
|
||||
|
||||
=head2 getQuestionEditVars ( $address )
|
||||
|
|
|
|||
|
|
@ -143,10 +143,14 @@ sub generateFeed {
|
|||
my $cache = WebGUI::Cache->new($self->session, $url, "RSS");
|
||||
my $value = $cache->get;
|
||||
unless ($value) {
|
||||
$value = $cache->setByHTTP($url, $self->get("cacheTimeout"));
|
||||
$value = $cache->setByHTTP($url, $self->get("cacheTimeout"));
|
||||
$newlyCached = 1;
|
||||
}
|
||||
eval { $feed->merge($value) };
|
||||
utf8::downgrade($value);
|
||||
eval {
|
||||
my $singleFeed = XML::FeedPP->new($value, utf8_flag => 1);
|
||||
$feed->merge($singleFeed);
|
||||
};
|
||||
if (my $e = WebGUI::Error->caught()) {
|
||||
$log->error("Syndicated Content asset (".$self->getId.") has a bad feed URL (".$url."). Failed with ".$e->message);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ use WebGUI::Text;
|
|||
use WebGUI::Form::File;
|
||||
use WebGUI::DateTime;
|
||||
use base 'WebGUI::Asset::Wobject';
|
||||
use Data::Dumper;
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -200,6 +201,38 @@ sub canViewThing {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 badOtherThing ( tableName, fieldName )
|
||||
|
||||
Checks that the table and field for the other Thing are okay. Returns 0 if okay,
|
||||
otherwise, returns an i18n message appropriate for the type of error, like the
|
||||
table or the field in the table not existing.
|
||||
|
||||
=head3 tableName
|
||||
|
||||
The table name for the other thing.
|
||||
|
||||
=head3 fieldName
|
||||
|
||||
The field in the other thing to check for.
|
||||
|
||||
=cut
|
||||
|
||||
sub badOtherThing {
|
||||
my ($self, $tableName, $fieldName) = @_;
|
||||
my $session = $self->session;
|
||||
my $db = $session->db;
|
||||
my $i18n = WebGUI::International->new($session, 'Asset_Thingy');
|
||||
my ($otherThingTableExists) = $db->quickArray('show tables like ?',[$tableName]);
|
||||
return $i18n->get('other thing missing message') unless $otherThingTableExists;
|
||||
my ($otherThingFieldExists) = $db->quickArray(
|
||||
sprintf('show columns from %s like ?', $db->dbh->quote_identifier($tableName)),
|
||||
[$fieldName]);
|
||||
return $i18n->get('other thing field missing message') unless $otherThingFieldExists;
|
||||
return undef;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 definition ( )
|
||||
|
||||
defines wobject properties for Thingy instances. If you choose to "autoGenerateForms", the
|
||||
|
|
@ -803,10 +836,11 @@ sub getFieldValue {
|
|||
my $otherThingId = $field->{fieldType};
|
||||
$otherThingId =~ s/^otherThing_//x;
|
||||
my $tableName = 'Thingy_'.$otherThingId;
|
||||
my ($otherThingTableExists) = $self->session->db->quickArray('show tables like ?',[$tableName]);
|
||||
if ($otherThingTableExists){
|
||||
my $fieldName = 'field_'.$field->{fieldInOtherThingId};
|
||||
my $badThing = $self->badOtherThing($tableName, $fieldName);
|
||||
if (! $badThing){
|
||||
($processedValue) = $self->session->db->quickArray('select '
|
||||
.$dbh->quote_identifier('field_'.$field->{fieldInOtherThingId})
|
||||
.$dbh->quote_identifier($fieldName)
|
||||
.' from '.$dbh->quote_identifier($tableName)
|
||||
.' where thingDataId = ?',[$value]);
|
||||
}
|
||||
|
|
@ -840,9 +874,10 @@ sub getFormElement {
|
|||
my $self = shift;
|
||||
my $data = shift;
|
||||
my %param;
|
||||
my $db = $self->session->db;
|
||||
my $session = $self->session;
|
||||
my $db = $session->db;
|
||||
my $dbh = $db->dbh;
|
||||
my $i18n = WebGUI::International->new($self->session,"Asset_Thingy");
|
||||
my $i18n = WebGUI::International->new($session,"Asset_Thingy");
|
||||
|
||||
$param{name} = "field_".$data->{fieldId};
|
||||
my $name = $param{name};
|
||||
|
|
@ -865,7 +900,7 @@ sub getFormElement {
|
|||
if (WebGUI::Utility::isIn($data->{fieldType},qw(SelectList CheckList SelectBox Attachments))) {
|
||||
my @defaultValues;
|
||||
if ($self->session->form->param($name)) {
|
||||
@defaultValues = $self->session->form->selectList($name);
|
||||
@defaultValues = $session->form->selectList($name);
|
||||
}
|
||||
else {
|
||||
foreach (split(/\n/x, $data->{value})) {
|
||||
|
|
@ -881,7 +916,7 @@ sub getFormElement {
|
|||
if ($class->isa('WebGUI::Form::List')) {
|
||||
delete $param{size};
|
||||
|
||||
my $values = WebGUI::Operation::Shared::secureEval($self->session,$data->{possibleValues});
|
||||
my $values = WebGUI::Operation::Shared::secureEval($session,$data->{possibleValues});
|
||||
if (ref $values eq 'HASH') {
|
||||
$param{options} = $values;
|
||||
}
|
||||
|
|
@ -909,30 +944,30 @@ sub getFormElement {
|
|||
my $otherThingId = $data->{fieldType};
|
||||
$otherThingId =~ s/^otherThing_(.*)/$1/x;
|
||||
$param{fieldType} = "SelectList";
|
||||
$class = 'WebGUI::Form::'. $param{fieldType};
|
||||
my $options = ();
|
||||
|
||||
my $tableName = 'Thingy_'.$otherThingId;
|
||||
my ($otherThingTableExists) = $db->quickArray('show tables like ?',[$tableName]);
|
||||
if ($otherThingTableExists){
|
||||
$options = $db->buildHashRef('select thingDataId, '
|
||||
.$dbh->quote_identifier('field_'.$data->{fieldInOtherThingId})
|
||||
.' from '.$dbh->quote_identifier($tableName));
|
||||
|
||||
my $value = $data->{value} || $data->{defaultValue};
|
||||
($param{value}) = $db->quickArray('select '
|
||||
.$dbh->quote_identifier('field_'.$data->{fieldInOtherThingId})
|
||||
.' from '.$dbh->quote_identifier($tableName)
|
||||
.' where thingDataId = ?',[$value]);
|
||||
}
|
||||
else{
|
||||
return $i18n->get('other thing missing message');
|
||||
}
|
||||
my $fieldName = 'field_'.$data->{fieldInOtherThingId};
|
||||
my $errorMessage = $self->badOtherThing($tableName, $fieldName);
|
||||
return $errorMessage if $errorMessage;
|
||||
|
||||
$options = $db->buildHashRef('select thingDataId, '
|
||||
.$dbh->quote_identifier($fieldName)
|
||||
.' from '.$dbh->quote_identifier($tableName));
|
||||
|
||||
my $value = $data->{value} || $data->{defaultValue};
|
||||
($param{value}) = $db->quickArray('select '
|
||||
.$dbh->quote_identifier($fieldName)
|
||||
.' from '.$dbh->quote_identifier($tableName)
|
||||
.' where thingDataId = ?',[$value]);
|
||||
$param{size} = 1;
|
||||
$param{multiple} = 0;
|
||||
$param{options} = $options;
|
||||
$param{value} = $data->{value} || $data->{defaultValue};
|
||||
}
|
||||
|
||||
my $formElement = eval { WebGUI::Pluggable::instanciate($class, "new", [$self->session, \%param ])};
|
||||
my $formElement = eval { WebGUI::Pluggable::instanciate($class, "new", [$session, \%param ])};
|
||||
return $formElement->toHtml();
|
||||
|
||||
}
|
||||
|
|
@ -1048,6 +1083,10 @@ sub getViewThingVars {
|
|||
"label" => $field{label},
|
||||
"isHidden" => $hidden,
|
||||
"url" => $otherThingUrl,
|
||||
"isVisible" => ($field{status} eq "visible" && !$hidden),
|
||||
"isRequired" => ($field{status} eq "required" && !$hidden),
|
||||
"pretext" => $field{pretext},
|
||||
"subtext" => $field{subtext},
|
||||
);
|
||||
push(@viewScreenTitleFields,$value) if ($field{viewScreenTitle});
|
||||
push(@field_loop, { map {("field_".$_ => $fieldProperties{$_})} keys(%fieldProperties) });
|
||||
|
|
@ -1657,6 +1696,9 @@ sub www_editThing {
|
|||
if ($field->{fieldType} eq "File"){
|
||||
$formElement = "<input type='file' name='file'>";
|
||||
}
|
||||
if ($field->{fieldType} eq "Image"){
|
||||
$formElement = "<input type='file' name='image'>";
|
||||
}
|
||||
else{
|
||||
$formElement = $self->getFormElement($field);
|
||||
}
|
||||
|
|
@ -1672,9 +1714,9 @@ sub www_editThing {
|
|||
." <td style='width:100px;' valign='top' class='formDescription'>".$field->{label}."</td>\n"
|
||||
." <td style='width:370px;'>".$formElement."</td>\n"
|
||||
." <td style='width:120px;' valign='top'> <input onClick=\"editListItem('".$self->session->url->page()
|
||||
."?func=editField;fieldId=".$field->{fieldId}.";thingId=".$thingId."','".$field->{fieldId}."')\" value='Edit' type='button'>"
|
||||
."?func=editField;fieldId=".$field->{fieldId}.";thingId=".$thingId."','".$field->{fieldId}."')\" value='".$i18n->get('Edit','Icon')."' type='button'>"
|
||||
."<input onClick=\"deleteListItem('".$self->session->url->page()."','".$field->{fieldId}."','".$thingId."')\" "
|
||||
."value='Delete' type='button'></td>\n</tr>\n</table>\n</li>\n";
|
||||
."value='".$i18n->get('Delete','Icon')."' type='button'></td>\n</tr>\n</table>\n</li>\n";
|
||||
|
||||
$fieldsViewScreen .= "<tr id='view_tr_".$field->{fieldId}."'>"
|
||||
."<td class='formDescription' style='width:180px;' id='view_label_".$field->{fieldId}."'>".$field->{label}
|
||||
|
|
@ -2088,6 +2130,9 @@ sub www_editFieldSave {
|
|||
if ($properties{fieldType} eq "File"){
|
||||
$formElement = "<input type='file' name='file'>";
|
||||
}
|
||||
elsif ($properties{fieldType} eq "Image"){
|
||||
$formElement = "<input type='file' name='image'>";
|
||||
}
|
||||
else{
|
||||
$formElement = $self->getFormElement(\%properties);
|
||||
}
|
||||
|
|
@ -2101,9 +2146,9 @@ sub www_editFieldSave {
|
|||
$listItemHTML = "<table>\n<tr>\n<td style='width:100px;' valign='top' class='formDescription'>".$label."</td>\n"
|
||||
."<td style='width:370px;'>".$formElement."</td>\n"
|
||||
."<td style='width:120px;' valign='top'> <input onClick=\"editListItem('".$self->session->url->page()
|
||||
."?func=editField;fieldId=".$newFieldId.";thingId=".$properties{thingId}."','".$newFieldId."')\" value='Edit' type='button'>"
|
||||
."?func=editField;fieldId=".$newFieldId.";thingId=".$properties{thingId}."','".$newFieldId."')\" value='".$i18n->get('Edit','Icon')."' type='button'>"
|
||||
."<input onClick=\"deleteListItem('".$self->session->url->page()."','".$newFieldId
|
||||
."','".$properties{thingId}."')\" value='Delete' type='button'></td>\n</tr>\n</table>";
|
||||
."','".$properties{thingId}."')\" value='".$i18n->get('Delete','Icon')."' type='button'></td>\n</tr>\n</table>";
|
||||
|
||||
$session->output->print($newFieldId.$listItemHTML);
|
||||
return "chunked";
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ package WebGUI::Asset::Wobject::UserList;
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use HTML::Entities;
|
||||
use Tie::CPHash;
|
||||
use Tie::IxHash;
|
||||
|
|
|
|||
|
|
@ -43,8 +43,9 @@ sub _isValidLDAPUser {
|
|||
my $self = shift;
|
||||
my ($error, $ldap, $search, $auth, $connectDN);
|
||||
my $i18n = WebGUI::International->new($self->session);
|
||||
|
||||
|
||||
my $connection = $self->getLDAPConnection;
|
||||
return 0 unless $connection;
|
||||
|
||||
#Check to see that the LDAP Link is valid
|
||||
my $ldapLink = $self->getLDAPLink;
|
||||
|
|
@ -52,12 +53,19 @@ sub _isValidLDAPUser {
|
|||
$self->error('<li>'.$i18n->get(2,'AuthLDAP').'</li>');
|
||||
return 0;
|
||||
}
|
||||
my $username = $self->session->form->get("authLDAP_ldapId") || $self->session->form->get("username");
|
||||
my $password = $self->session->form->get("authLDAP_identifier") || $self->session->form->get("identifier");
|
||||
|
||||
my $uri = URI->new($connection->{ldapUrl}) or $error = '<li>'.$i18n->get(2,'AuthLDAP').'</li>';
|
||||
|
||||
if($error ne ""){
|
||||
$self->error($error);
|
||||
return 0;
|
||||
}
|
||||
|
||||
my $username = $self->session->form->get("authLDAP_ldapId") || $self->session->form->get("username");
|
||||
my $password = $self->session->form->get("authLDAP_identifier") || $self->session->form->get("identifier");
|
||||
|
||||
# Create an LDAP object
|
||||
if ($ldap = $ldapLink->connectToLDAP) {
|
||||
if ($ldap = Net::LDAP->new($uri->host, (port=>$uri->port))) {
|
||||
|
||||
my $uri = $ldapLink->getURI;
|
||||
# Bind as a proxy user to search for the user trying to login
|
||||
if($connection->{connectDn}) {
|
||||
|
|
@ -85,7 +93,7 @@ sub _isValidLDAPUser {
|
|||
# Remember the users DN so we can use it later.
|
||||
$self->setConnectDN($connectDN);
|
||||
$ldap->unbind;
|
||||
|
||||
|
||||
# Create a new LDAP object
|
||||
$ldap = $ldapLink->connectToLDAP or $error .= $i18n->get(2,'AuthLDAP');
|
||||
|
||||
|
|
@ -117,7 +125,7 @@ sub _isValidLDAPUser {
|
|||
$error = '<li>'.$i18n->get(2,'AuthLDAP').'</li>';
|
||||
$self->session->errorHandler->error("Couldn't create LDAP object: ".$connection->{ldapUrl});
|
||||
}
|
||||
|
||||
|
||||
$self->error($error);
|
||||
|
||||
# Return 1 on successful authentication
|
||||
|
|
@ -148,7 +156,7 @@ sub authenticate {
|
|||
my $userId = $self->userId;
|
||||
my $identifier = $_[1];
|
||||
my $userData = $self->getParams;
|
||||
|
||||
|
||||
$error .= '<li>'.$i18n->get(12,'AuthLDAP').'</li>' if ($userData->{ldapUrl} eq "");
|
||||
$error .= '<li>'.$i18n->get(11,'AuthLDAP').'</li>' if ($userData->{connectDN} eq "");
|
||||
$self->error($error);
|
||||
|
|
@ -157,7 +165,7 @@ sub authenticate {
|
|||
$self->user(WebGUI::User->new($self->session,1));
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
|
||||
if($uri = URI->new($userData->{ldapUrl})) {
|
||||
|
||||
# Create an LDAP object
|
||||
|
|
@ -179,14 +187,14 @@ sub authenticate {
|
|||
$error .= '<li>LDAP error "'.$self->ldapStatusCode($auth->code).'" occured.'.$i18n->get(69).'</li>';
|
||||
$self->session->errorHandler->error("LDAP error: ".$self->ldapStatusCode($auth->code));
|
||||
}
|
||||
|
||||
|
||||
$ldap->unbind;
|
||||
}
|
||||
else {
|
||||
$error .= '<li>'.$i18n->get(13,'AuthLDAP').'</li>';
|
||||
$self->session->errorHandler->error("Could not process this LDAP URL: ".$userData->{ldapUrl});
|
||||
}
|
||||
|
||||
|
||||
if($error ne ""){
|
||||
$self->error($error);
|
||||
$self->user(WebGUI::User->new($self->session,1));
|
||||
|
|
@ -208,8 +216,9 @@ sub connectToLDAP {
|
|||
my $self = shift;
|
||||
my $connectionId = $self->session->form->process("connection") || $self->session->setting->get("ldapConnection");
|
||||
my $ldapLink = WebGUI::LDAPLink->new($self->session,$connectionId);
|
||||
return undef unless defined $ldapLink;
|
||||
my $connection = $ldapLink->get;
|
||||
|
||||
|
||||
$self->{'_ldapLink' } = $ldapLink;
|
||||
$self->{'_connection'} = $connection;
|
||||
return $connection;
|
||||
|
|
@ -227,13 +236,17 @@ sub createAccount {
|
|||
elsif (!$self->session->setting->get("anonymousRegistration") && !$self->session->setting->get('inboxInviteUserEnabled')) {
|
||||
return $self->displayLogin;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
my $connection = $self->getLDAPConnection;
|
||||
if (! $connection) {
|
||||
$self->session->log->error('Unable to create LDAP account as there is no LDAP connection defined');
|
||||
return $self->displayLogin;
|
||||
}
|
||||
$vars->{'create.message'} = $message if ($message);
|
||||
my $i18n = WebGUI::International->new($self->session,"AuthLDAP");
|
||||
$vars->{'create.form.ldapConnection.label'} = $i18n->get("ldapConnection");
|
||||
|
||||
|
||||
my $url = $self->session->url->page("op=auth;method=createAccount;connection=");
|
||||
$vars->{'create.form.ldapConnection'} = WebGUI::Form::selectBox($self->session, {
|
||||
name=>"ldapConnection",
|
||||
|
|
@ -256,30 +269,31 @@ sub createAccount {
|
|||
extras => $self->getExtrasStyle($ldapPwd)
|
||||
});
|
||||
$vars->{'create.form.password.label'} = $connection->{ldapPasswordName};
|
||||
|
||||
|
||||
$vars->{'create.form.hidden'} = WebGUI::Form::hidden($self->session,{"name"=>"confirm","value"=>$confirm});
|
||||
return $self->SUPER::createAccount("createAccountSave",$vars);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub createAccountSave {
|
||||
my $self = shift;
|
||||
my $username = $self->session->form->process('authLDAP_ldapId');
|
||||
my $password = $self->session->form->process('authLDAP_identifier');
|
||||
my $error = "";
|
||||
my $i18n = WebGUI::International->new($self->session);
|
||||
|
||||
#Validate user in LDAP
|
||||
if(!$self->_isValidLDAPUser()){
|
||||
return $self->createAccount("<h1>".$i18n->get(70)."</h1>".$self->error);
|
||||
}
|
||||
|
||||
my $connection = $self->getLDAPConnection;
|
||||
my $ldapLink = $self->getLDAPLink;
|
||||
my $self = shift;
|
||||
my $username = $self->session->form->process('authLDAP_ldapId');
|
||||
my $password = $self->session->form->process('authLDAP_identifier');
|
||||
my $error = "";
|
||||
my $i18n = WebGUI::International->new($self->session);
|
||||
|
||||
#Get connectDN from settings
|
||||
my $ldap = $ldapLink->connectToLDAP;
|
||||
my $uri = $ldapLink->getURI;
|
||||
#Validate user in LDAP
|
||||
if(!$self->_isValidLDAPUser()){
|
||||
return $self->createAccount("<h1>".$i18n->get(70)."</h1>".$self->error);
|
||||
}
|
||||
|
||||
my $connection = $self->getLDAPConnection;
|
||||
if (! $connection) {
|
||||
return $self->createAccount("<h1>".$i18n->get('no ldap link for auth')."</h1>".$self->error);
|
||||
}
|
||||
#Get connectDN from settings
|
||||
my $uri = URI->new($connection->{ldapUrl});
|
||||
my $ldap = Net::LDAP->new($uri->host, (port=>$uri->port));
|
||||
my $auth;
|
||||
if($connection->{connectDn}) {
|
||||
$auth = $ldap->bind(dn=>$connection->{connectDn}, password=>$connection->{identifier});
|
||||
|
|
@ -299,28 +313,19 @@ sub createAccountSave {
|
|||
}
|
||||
}
|
||||
$ldap->unbind;
|
||||
|
||||
|
||||
|
||||
|
||||
#Check that username is valid and not a duplicate in the system.
|
||||
$error .= $self->error if(!$self->validUsername($username));
|
||||
#Validate profile data.
|
||||
my $fields = WebGUI::ProfileField->getEditableFields($self->session);
|
||||
my $retHash = $self->user->validateProfileDataFromForm($fields);
|
||||
my $profile = $retHash->{profile};
|
||||
my $temp = "";
|
||||
my $warning = "";
|
||||
|
||||
my $format = "<li>%s</li>";
|
||||
map { $warning .= sprintf($format,$_) } @{$retHash->{warnings}};
|
||||
map { $temp .= sprintf($format,$_) } @{$retHash->{errors}};
|
||||
|
||||
my ($profile, $temp, $warning) = WebGUI::Operation::Profile::validateProfileData($self->session);
|
||||
$error .= $temp;
|
||||
return $self->createAccount("<li>".$error."</li>") unless ($error eq "");
|
||||
return $self->createAccount("<li>".$error."</li1>") unless ($error eq "");
|
||||
#If Email address is not unique, a warning is displayed
|
||||
if($warning ne "" && !$self->session->form->process("confirm")){
|
||||
return $self->createAccount('<li>'.$i18n->get(1078).'</li>', 1);
|
||||
}
|
||||
|
||||
|
||||
my $properties;
|
||||
$properties->{connectDN} = $connectDN;
|
||||
$properties->{ldapUrl} = $connection->{ldapUrl};
|
||||
|
|
@ -331,9 +336,9 @@ sub createAccountSave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub deactivateAccount {
|
||||
my $self = shift;
|
||||
return $self->displayLogin if($self->isVisitor);
|
||||
return $self->SUPER::deactivateAccount("deactivateAccountConfirm");
|
||||
my $self = shift;
|
||||
return $self->displayLogin if($self->userId eq '1');
|
||||
return $self->SUPER::deactivateAccount("deactivateAccountConfirm");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -388,9 +393,10 @@ sub displayLogin {
|
|||
=cut
|
||||
|
||||
sub editUserForm {
|
||||
my $self = shift;
|
||||
my $self = shift;
|
||||
my $userData = $self->getParams;
|
||||
my $connection = $self->getLDAPConnection;
|
||||
return '' unless $connection;
|
||||
my $ldapUrl = $self->session->form->process('authLDAP_ldapUrl') || $userData->{ldapUrl} || $connection->{ldapUrl};
|
||||
my $connectDN = $self->session->form->process('authLDAP_connectDN') || $userData->{connectDN};
|
||||
my $ldapConnection = $self->session->form->process('authLDAP_ldapConnection') || $userData->{ldapConnection};
|
||||
|
|
@ -490,6 +496,8 @@ sub editUserSettingsFormSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub getAccountTemplateId {
|
||||
my $self = shift;
|
||||
my $ldapConnect = $self->getLDAPConnection;
|
||||
return "PBtmpl0000000000000004" unless $ldapConnect;
|
||||
return ($self->getLDAPConnection->{ldapAccountTemplate} || "PBtmpl0000000000000004");
|
||||
}
|
||||
|
||||
|
|
@ -502,13 +510,15 @@ sub getConnectDN {
|
|||
#-------------------------------------------------------------------
|
||||
sub getCreateAccountTemplateId {
|
||||
my $self = shift;
|
||||
my $ldapConnect = $self->getLDAPConnection;
|
||||
return "PBtmpl0000000000000005" unless $ldapConnect;
|
||||
return ($self->getLDAPConnection->{ldapCreateAccountTemplate} || "PBtmpl0000000000000005");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getLDAPConnection {
|
||||
my $self = shift;
|
||||
|
||||
|
||||
return $self->{_connection} if $self->{_connection};
|
||||
return $self->connectToLDAP;
|
||||
}
|
||||
|
|
@ -523,34 +533,41 @@ sub getLDAPLink {
|
|||
#-------------------------------------------------------------------
|
||||
sub getLoginTemplateId {
|
||||
my $self = shift;
|
||||
my $ldapConnect = $self->getLDAPConnection;
|
||||
return "PBtmpl0000000000000006" unless $ldapConnect;
|
||||
return ($self->getLDAPConnection->{ldapLoginTemplate} || "PBtmpl0000000000000006");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub login {
|
||||
my $self = shift;
|
||||
my $i18n = WebGUI::International->new($self->session);
|
||||
my $username = $self->session->form->process("username");
|
||||
my $identifier = $self->session->form->process("identifier");
|
||||
my $autoRegistration = $self->session->setting->get("automaticLDAPRegistration");
|
||||
my $hasAuthenticated = 0;
|
||||
|
||||
$hasAuthenticated = 1 if ( $self->authenticate($username,$identifier) );
|
||||
|
||||
my $self = shift;
|
||||
my $i18n = WebGUI::International->new($self->session);
|
||||
my $username = $self->session->form->process("username");
|
||||
my $identifier = $self->session->form->process("identifier");
|
||||
my $autoRegistration = $self->session->setting->get("automaticLDAPRegistration");
|
||||
my $hasAuthenticated = 0;
|
||||
|
||||
$hasAuthenticated = 1 if ( $self->authenticate($username,$identifier) );
|
||||
|
||||
my $connection = $self->getLDAPConnection;
|
||||
if (! $connection) {
|
||||
return $self->displayLogin("<h1>".$i18n->get('no ldap logins')."</h1>".$self->error);
|
||||
}
|
||||
|
||||
# Autoregistration is on and they didn't authenticate yet
|
||||
if ($autoRegistration && !$hasAuthenticated) {
|
||||
# See if they are in LDAP and if so that they can bind with the password given.
|
||||
if($self->_isValidLDAPUser()) {
|
||||
|
||||
|
||||
# Create a WebGUI Account
|
||||
if ($self->validUsername($username)) {
|
||||
$self->SUPER::createAccountSave($username, {
|
||||
connectDN => $self->getConnectDN,
|
||||
ldapUrl => $self->getLDAPConnection->{ldapUrl},
|
||||
ldapConnection => $self->getLDAPConnection->{ldapLinkId},
|
||||
connectDN => $self->getConnectDN,
|
||||
ldapUrl => $connection->{ldapUrl},
|
||||
ldapConnection => $connection->{ldapLinkId},
|
||||
},$identifier);
|
||||
$hasAuthenticated = 1;
|
||||
|
||||
|
||||
# Pull the users profile from LDAP to WebGUI
|
||||
WebGUI::Workflow::Instance->create($self->session, {
|
||||
workflowId=>'AuthLDAPworkflow000001',
|
||||
|
|
@ -579,7 +596,7 @@ sub new {
|
|||
#my $connection = $session->scratch->get("ldapConnection") || $session->setting->get("ldapConnection");
|
||||
#my $ldaplink = WebGUI::LDAPLink->new($session,$connection);
|
||||
#$self->{_connection} = $ldaplink->get if $ldaplink;
|
||||
|
||||
|
||||
my $i18n = WebGUI::International->new($session, "AuthLDAP");
|
||||
my %ldapStatusCode = map { $_ => $i18n->get("LDAPLink_".$_) }
|
||||
(0..21, 32,33,34,36, 48..54, 64..71, 80);
|
||||
|
|
@ -600,4 +617,4 @@ sub setConnectDN {
|
|||
}
|
||||
|
||||
|
||||
1;
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -900,7 +900,7 @@ sub profileRecoverPasswordFinish {
|
|||
my $username;
|
||||
if ($self->getSetting('passwordRecoveryRequireUsername')) {
|
||||
$username = $self->session->form->process('authWebGUI.username');
|
||||
return $self->recoverPassword($i18n2->get('password recovery no username')) unless defined $username;
|
||||
return $self->recoverPassword($i18n->get('password recovery no username', 'AuthWebGUI')) unless defined $username;
|
||||
}
|
||||
|
||||
my @fields = @{WebGUI::ProfileField->getPasswordRecoveryFields($self->session)};
|
||||
|
|
@ -1011,7 +1011,6 @@ sub emailRecoverPasswordFinish {
|
|||
return $self->displayLogin unless ($self->session->setting->get('webguiPasswordRecovery') ne '') and $self->isVisitor;
|
||||
|
||||
my $i18n = WebGUI::International->new($self->session);
|
||||
my $i18n2 = WebGUI::International->new($self->session, 'AuthWebGUI');
|
||||
my $session = $self->session;
|
||||
my ($form) = $session->quick(qw/form/);
|
||||
my $email = $form->param('email');
|
||||
|
|
@ -1032,7 +1031,7 @@ sub emailRecoverPasswordFinish {
|
|||
|
||||
# Make sure the user is Active
|
||||
if ( $user->status ne "Active" ) {
|
||||
return $self->recoverPassword( $i18n2->get( 'password recovery disabled' ) );
|
||||
return $self->recoverPassword( $i18n->get( 'password recovery disabled', 'AuthWebGUI' ) );
|
||||
}
|
||||
|
||||
# generate information necessry to proceed
|
||||
|
|
@ -1041,6 +1040,10 @@ sub emailRecoverPasswordFinish {
|
|||
my $userId = $user->userId; #get the user guid
|
||||
$email = $user->profileField('email');
|
||||
|
||||
if ( ! $email ) {
|
||||
return $self->recoverPassword( $i18n->get( 'no email address', 'AuthWebGUI' ) );
|
||||
}
|
||||
|
||||
my $authsettings = $self->getParams($userId);
|
||||
$authsettings->{emailRecoverPasswordVerificationNumber} = $recoveryGuid;
|
||||
|
||||
|
|
@ -1208,13 +1211,17 @@ sub resetExpiredPasswordSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub validateEmail {
|
||||
my $self = shift;
|
||||
my ($userId) = $self->session->db->quickArray("select userId from authentication where fieldData=? and fieldName='emailValidationKey' and authMethod='WebGUI'", [$self->session->form->process("key")]);
|
||||
my $session = $self->session;
|
||||
my ($userId) = $session->db->quickArray("select userId from authentication where fieldData=? and fieldName='emailValidationKey' and authMethod='WebGUI'", [$session->form->process("key")]);
|
||||
my $i18n = WebGUI::International->new($session, 'AuthWebGUI');
|
||||
my $message = '';
|
||||
if (defined $userId) {
|
||||
my $u = WebGUI::User->new($self->session,$userId);
|
||||
my $u = WebGUI::User->new($session,$userId);
|
||||
$u->status("Active");
|
||||
$self->session->db->write("DELETE FROM authentication WHERE userId = ? AND fieldName = 'emailValidationKey'", [$userId]);
|
||||
$message = $i18n->get('email validation confirmed','AuthWebGUI');
|
||||
}
|
||||
return $self->displayLogin;
|
||||
return $self->displayLogin($message);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,24 @@ These subroutines are available from this package:
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 clearCache ( )
|
||||
|
||||
Clear the cache of in-memory configuration files. This is required by the upgrade script, which
|
||||
forks to run each upgrade. When the child is reaped, the original is untouched, so that the
|
||||
next script in the line recieves an old, in-memory config, essentially undoing any config
|
||||
changes in the first upgrade script.
|
||||
|
||||
This is a class method.
|
||||
|
||||
=cut
|
||||
|
||||
sub clearCache {
|
||||
my $class = shift;
|
||||
%config = ();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getCookieName ( )
|
||||
|
||||
Returns the cookie name defined in the config file. Returns "wgSession" if one isn't defined.
|
||||
|
|
|
|||
|
|
@ -553,10 +553,11 @@ Search assets underneath this asset.
|
|||
=cut
|
||||
|
||||
sub www_search {
|
||||
my $session = shift;
|
||||
my $ac = WebGUI::AdminConsole->new( $session, "assets" );
|
||||
my $i18n = WebGUI::International->new( $session, "Asset" );
|
||||
my $output = '<div id="assetSearch">' . getHeader( $session );
|
||||
my $session = shift;
|
||||
my $ac = WebGUI::AdminConsole->new( $session, "assets" );
|
||||
my $i18n = WebGUI::International->new( $session, "Asset" );
|
||||
my $currentAsset = getCurrentAsset($session);
|
||||
my $output = '<div id="assetSearch">' . getHeader( $session );
|
||||
|
||||
$session->style->setLink( $session->url->extras( 'yui-webgui/build/assetManager/assetManager.css' ), { rel => "stylesheet", type => 'text/css' } );
|
||||
$session->style->setScript( $session->url->extras( 'yui/build/yahoo-dom-event/yahoo-dom-event.js' ) );
|
||||
|
|
@ -564,20 +565,20 @@ sub www_search {
|
|||
$session->style->setScript( $session->url->extras( 'yui-webgui/build/form/form.js' ) );
|
||||
|
||||
### Show the form
|
||||
$output .= q{<form><p>}
|
||||
$output .= q{<form method="post" enctype="multipart/form-data" action="} . $currentAsset->getUrl . q{"><p>}
|
||||
. q{<input type="hidden" name="op" value="assetManager" />}
|
||||
. q{<input type="hidden" name="method" value="search" />}
|
||||
. q{<input type="text" size="45" name="keywords" value="} . $session->form->get('keywords') . q{" />}
|
||||
. getClassSelectBox( $session )
|
||||
. q{<button name="action" value="search">} . $i18n->get( "search" ) . q{</button>}
|
||||
. q{<input type="submit" name="action" value="}.$i18n->get( "search" ).q{" />}
|
||||
. q{</p></form>}
|
||||
;
|
||||
|
||||
### Actions
|
||||
if ( my $action = $session->form->get( 'action' ) ) {
|
||||
my @assetIds = $session->form->get( 'assetId' );
|
||||
if ( my $action = lc $session->form->get( 'action' ) ) {
|
||||
my @assetIds = $session->form->get( 'assetId' );
|
||||
|
||||
if ( $action eq "trash" ) {
|
||||
if ( $action eq "delete" ) { ##aka trash
|
||||
for my $assetId ( @assetIds ) {
|
||||
my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId );
|
||||
next unless $asset;
|
||||
|
|
@ -725,9 +726,9 @@ sub www_search {
|
|||
$output .= q{</tbody>}
|
||||
. q{</table>}
|
||||
. q{<p class="actions">} . $i18n->get( 'with selected' )
|
||||
. q{<button name="action" value="trash">} . $i18n->get( 'delete' ) . q{</button>}
|
||||
. q{<button name="action" value="cut">} . $i18n->get( "cut" ) . q{</button>}
|
||||
. q{<button name="action" value="copy">} . $i18n->get( "copy" ) . q{</button>}
|
||||
. q{<input type="submit" name="action" value="}.$i18n->get( 'delete' ) . q{" />}
|
||||
. q{<input type="submit" name="action" value="}.$i18n->get( "cut" ) . q{" />}
|
||||
. q{<input type="submit" name="action" value="}.$i18n->get( "copy" ) .q{" />}
|
||||
. q{</p>}
|
||||
. q{</form>}
|
||||
;
|
||||
|
|
|
|||
|
|
@ -219,12 +219,14 @@ sub www_show {
|
|||
$style->setLink($url->extras("/AttachmentsControl/AttachmentsControl.css"),
|
||||
{type=>"text/css", rel=>"stylesheet"});
|
||||
my $uploadControl = '';
|
||||
my $i18n = WebGUI::International->new($session, "Control_Attachments");
|
||||
my $i18n = WebGUI::International->new($session);
|
||||
my $maxFiles = $form->param('maxAttachments') - scalar(@assetIds) ;
|
||||
my $attachmentForms = '';
|
||||
foreach my $assetId (@assetIds) {
|
||||
$attachmentForms .= '<input type="hidden" name="attachments" value="'.$assetId.'" />';
|
||||
}
|
||||
my $upload = $i18n->get('Upload','Operation_FormHelpers');
|
||||
my $uploadAttachment = $i18n->get('Upload an attachment','WebGUI');
|
||||
if ($maxFiles > 0) {
|
||||
$uploadControl = '<div id="uploadForm">
|
||||
<a href="#" onclick="WebguiAttachmentUploadForm.hide();" id="uploadFormCloser">X</a>
|
||||
|
|
@ -237,8 +239,8 @@ sub www_show {
|
|||
<input type="hidden" name="class" value="Attachments" />
|
||||
<input type="hidden" name="sub" value="upload" /> '. $attachmentForms
|
||||
.'<input type="file" name="attachment" />
|
||||
<input type="submit" value="Upload" /> </form> </div>
|
||||
<a id="upload" href="#" onclick="WebguiAttachmentUploadForm.show();">Upload an attachment.</a>
|
||||
<input type="submit" value="'.$upload.'" /> </form> </div>
|
||||
<a id="upload" href="#" onclick="WebguiAttachmentUploadForm.show();">'.$uploadAttachment. '</a>
|
||||
';
|
||||
}
|
||||
my $attachments = '';
|
||||
|
|
@ -265,12 +267,13 @@ sub www_show {
|
|||
$attachments .= '</div>';
|
||||
}
|
||||
}
|
||||
my $instructions = $i18n->get('Upload attachments here. Copy and paste attachments into the editor.','WebGUI');
|
||||
my $output = '<html><head> '.$style->generateAdditionalHeadTags.'
|
||||
<script type="text/javascript">
|
||||
parent.document.getElementById("'.$form->get("name").'_formId").innerHTML = \''.$attachmentForms.'\';
|
||||
</script>
|
||||
</head> <body>
|
||||
'.$uploadControl.' <div id="instructions">Upload attachments here. Copy and paste attachments into the editor.</div>
|
||||
'.$uploadControl.' <div id="instructions">'.$instructions.'</div>
|
||||
<div id="attachments">'.$attachments.' </div> </body> </html> ';
|
||||
return $output;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use Tie::IxHash;
|
|||
use WebGUI::International;
|
||||
use WebGUI::Pluggable;
|
||||
use WebGUI::Utility;
|
||||
use Module::Find qw(findsubmod);
|
||||
use Module::Find qw(findallmod);
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -113,7 +113,7 @@ sub getTypes {
|
|||
my $self = shift;
|
||||
my @types = @{$self->get('types')};
|
||||
unless (scalar(@types)) {
|
||||
my @classes = findsubmod 'WebGUI::Form';
|
||||
my @classes = findallmod 'WebGUI::Form';
|
||||
for my $class (@classes) {
|
||||
if ($class =~ /^WebGUI::Form::(.*)/) {
|
||||
my $type = $1;
|
||||
|
|
@ -141,7 +141,7 @@ Returns either what's posted or if nothing comes back it returns "text".
|
|||
sub getValue {
|
||||
my $self = shift;
|
||||
my $fieldType = $self->SUPER::getValue(@_);
|
||||
$fieldType =~ s/[^\w]//g;
|
||||
$fieldType =~ s/[^\w:]//g;
|
||||
return $fieldType || "text";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ package WebGUI::Form::Interval;
|
|||
=cut
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use base qw(WebGUI::Form::Control);
|
||||
use Tie::IxHash;
|
||||
use WebGUI::Form::SelectBox;
|
||||
|
|
@ -119,6 +118,19 @@ sub getValue {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getValueAsHtml ( )
|
||||
|
||||
Returns the interval formatted as quantity and units.
|
||||
|
||||
=cut
|
||||
|
||||
sub getValueAsHtml {
|
||||
my $self = shift;
|
||||
return join ' ', $self->session->datetime->secondsToInterval($self->getOriginalValue);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 isDynamicCompatible ( )
|
||||
|
||||
A class method that returns a boolean indicating whether this control is compatible with the DynamicField control.
|
||||
|
|
@ -138,35 +150,38 @@ Renders an interval control.
|
|||
=cut
|
||||
|
||||
sub toHtml {
|
||||
my $self = shift;
|
||||
my %units;
|
||||
tie %units, 'Tie::IxHash';
|
||||
my $i18n = WebGUI::International->new($self->session);
|
||||
%units = ('seconds'=>$i18n->get(704),
|
||||
'minutes'=>$i18n->get(705),
|
||||
'hours'=>$i18n->get(706),
|
||||
'days'=>$i18n->get(700),
|
||||
'weeks'=>$i18n->get(701),
|
||||
'months'=>$i18n->get(702),
|
||||
'years'=>$i18n->get(703));
|
||||
my ($interval, $units) = $self->session->datetime->secondsToInterval($self->getOriginalValue);
|
||||
# not sure why, but these things need to be defined like this or
|
||||
# they fail under some circumstnaces
|
||||
my $cmd = "WebGUI::Form::Integer";
|
||||
my $out = $cmd->new($self->session,
|
||||
name=>$self->get("name")."_interval",
|
||||
value=>$interval,
|
||||
extras=>$self->get("extras"),
|
||||
id=>$self->get('id')."_interval",
|
||||
)->toHtml;
|
||||
$cmd = "WebGUI::Form::SelectBox";
|
||||
$out .= $cmd->new($self->session,
|
||||
options=>\%units,
|
||||
name=>$self->get("name")."_units",
|
||||
id=>$self->get('id')."_units",
|
||||
value=>$units
|
||||
)->toHtml;
|
||||
return $out;
|
||||
my $self = shift;
|
||||
my %units;
|
||||
tie %units, 'Tie::IxHash';
|
||||
my $i18n = WebGUI::International->new($self->session);
|
||||
%units = (seconds => $i18n->get(704),
|
||||
minutes => $i18n->get(705),
|
||||
hours => $i18n->get(706),
|
||||
days => $i18n->get(700),
|
||||
weeks => $i18n->get(701),
|
||||
months => $i18n->get(702),
|
||||
years => $i18n->get(703),
|
||||
);
|
||||
my %reverseUnits = reverse %units;
|
||||
my ($interval, $units) = $self->session->datetime->secondsToInterval($self->getOriginalValue);
|
||||
# not sure why, but these things need to be defined like this or
|
||||
# they fail under some circumstnaces
|
||||
my $cmd = "WebGUI::Form::Integer";
|
||||
my $out = $cmd->new($self->session,
|
||||
name => $self->get("name")."_interval",
|
||||
value => $interval,
|
||||
extras => $self->get("extras"),
|
||||
id => $self->get('id')."_interval",
|
||||
)->toHtml;
|
||||
$cmd = "WebGUI::Form::SelectBox";
|
||||
my $key = $reverseUnits{$units};
|
||||
$out .= $cmd->new($self->session,
|
||||
options => \%units,
|
||||
name => $self->get("name")."_units",
|
||||
id => $self->get('id')."_units",
|
||||
value => $key,
|
||||
)->toHtml;
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -168,18 +168,22 @@ Renders the form field to HTML as a table row complete with labels, subtext, hov
|
|||
=cut
|
||||
|
||||
sub toHtmlWithWrapper {
|
||||
my $self = shift;
|
||||
my $template = WebGUI::Asset::Template->new($self->session,$self->getOriginalValue());
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $template = WebGUI::Asset::Template->new($session,$self->getOriginalValue());
|
||||
if (defined $template && $template->canEdit) {
|
||||
my $returnUrl;
|
||||
if (defined $self->session->asset && ref $self->session->asset ne "WebGUI::Asset::Template") {
|
||||
$returnUrl = ";proceed=goBackToPage;returnUrl=".$self->session->url->escape($self->session->asset->getUrl);
|
||||
}
|
||||
my $buttons = $self->session->icon->edit("func=edit".$returnUrl,$template->get("url"));
|
||||
$buttons .= $self->session->icon->manage("op=assetManager",$template->getParent->get("url"));
|
||||
$self->set("subtext",$buttons . $self->get("subtext"));
|
||||
}
|
||||
return $self->SUPER::toHtmlWithWrapper;
|
||||
my $returnUrl;
|
||||
if (defined $session->asset && ref $session->asset ne "WebGUI::Asset::Template") {
|
||||
$returnUrl = ";proceed=goBackToPage;returnUrl=".$session->url->escape($self->session->asset->getUrl);
|
||||
}
|
||||
my $buttons = $session->icon->edit("func=edit".$returnUrl,$template->get("url"));
|
||||
my $parent = $template->getParent();
|
||||
if (defined $parent) {
|
||||
$buttons .= $session->icon->manage("op=assetManager",$template->getParent->get("url"));
|
||||
}
|
||||
$self->set("subtext",$buttons . $self->get("subtext"));
|
||||
}
|
||||
return $self->SUPER::toHtmlWithWrapper;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
70
lib/WebGUI/Help/Account.pm
Normal file
70
lib/WebGUI/Help/Account.pm
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
package WebGUI::Help::Account;
|
||||
|
||||
use strict;
|
||||
|
||||
our $HELP = {
|
||||
'layout template' => {
|
||||
title => 'account layout template',
|
||||
body => '',
|
||||
isa => [
|
||||
{
|
||||
tag => 'common vars',
|
||||
namespace => 'Account',
|
||||
},
|
||||
{
|
||||
tag => "template variables",
|
||||
namespace => "Asset_Template",
|
||||
},
|
||||
],
|
||||
fields => [ ],
|
||||
variables => [
|
||||
{
|
||||
name => "account_loop",
|
||||
variables => [
|
||||
{
|
||||
name => "title",
|
||||
description => "account title",
|
||||
},
|
||||
{
|
||||
name => "identifier",
|
||||
description => "account identifier",
|
||||
},
|
||||
{
|
||||
name => "className",
|
||||
description => "account className",
|
||||
},
|
||||
{
|
||||
name => "is_[[IDENTIFIER]]",
|
||||
},
|
||||
{
|
||||
name => "account url",
|
||||
},
|
||||
{
|
||||
name => "is_method_[[METHOD]]",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
related => [ ],
|
||||
},
|
||||
|
||||
'common vars' => {
|
||||
title => 'common account variables',
|
||||
body => '',
|
||||
private => 1,
|
||||
isa => [ ],
|
||||
fields => [ ],
|
||||
variables => [
|
||||
{ name => "user_full_name", },
|
||||
{ name => "user_member_since", },
|
||||
{ name => "view_profile_url", },
|
||||
{ name => "root_url", },
|
||||
{ name => "back_url", },
|
||||
],
|
||||
related => [ ],
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
#vim:ft=perl
|
||||
72
lib/WebGUI/Help/Account_Contributions.pm
Normal file
72
lib/WebGUI/Help/Account_Contributions.pm
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
package WebGUI::Help::Account_Contributions;
|
||||
|
||||
use strict;
|
||||
|
||||
our $HELP = {
|
||||
'layout template' => {
|
||||
title => 'account contributions layout template',
|
||||
body => '',
|
||||
isa => [
|
||||
{
|
||||
tag => 'template variables',
|
||||
namespace => 'Asset_Template',
|
||||
},
|
||||
{
|
||||
tag => 'pagination template variables',
|
||||
namespace => 'WebGUI',
|
||||
},
|
||||
],
|
||||
fields => [ ],
|
||||
variables => [
|
||||
{
|
||||
name => 'title_url',
|
||||
},
|
||||
{
|
||||
name => 'type_url',
|
||||
},
|
||||
{
|
||||
name => 'dateStamp_url',
|
||||
},
|
||||
{
|
||||
name => 'rpp_url',
|
||||
},
|
||||
{
|
||||
name => 'has_contributions',
|
||||
},
|
||||
{
|
||||
name => 'contributions_total',
|
||||
},
|
||||
{
|
||||
name => 'user_full_name',
|
||||
},
|
||||
{
|
||||
name => 'user_member_since',
|
||||
},
|
||||
{
|
||||
name => 'view_profile_url',
|
||||
namespace => 'Account',
|
||||
},
|
||||
{
|
||||
name => 'root_url',
|
||||
namespace => 'Account',
|
||||
},
|
||||
{
|
||||
name => 'back_url',
|
||||
namespace => 'Account',
|
||||
},
|
||||
{
|
||||
name => 'contributions_loop',
|
||||
variables => [
|
||||
{
|
||||
name => 'contributions_variables',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
related => [ ],
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
#vim:ft=perl
|
||||
33
lib/WebGUI/Help/Account_Inbox.pm
Normal file
33
lib/WebGUI/Help/Account_Inbox.pm
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
package WebGUI::Help::Account_Inbox;
|
||||
|
||||
use strict;
|
||||
|
||||
our $HELP = {
|
||||
|
||||
'common vars' => {
|
||||
title => 'common account variables',
|
||||
body => '',
|
||||
private => 1,
|
||||
isa => [
|
||||
{
|
||||
tag => 'common vars',
|
||||
namespace => 'Account',
|
||||
},
|
||||
],
|
||||
fields => [ ],
|
||||
variables => [
|
||||
{ name => 'view_inbox_url', },
|
||||
{ name => 'view_invitations_url', },
|
||||
{ name => 'unread_message_count', },
|
||||
{ name => 'invitation_count', },
|
||||
{ name => 'invitations_enabled', },
|
||||
{ name => 'user_invitations_enabled', },
|
||||
{ name => 'invite_friend_url', },
|
||||
],
|
||||
related => [ ],
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
#vim:ft=perl
|
||||
28
lib/WebGUI/Help/Account_Shop.pm
Normal file
28
lib/WebGUI/Help/Account_Shop.pm
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
package WebGUI::Help::Account_Shop;
|
||||
|
||||
use strict;
|
||||
|
||||
our $HELP = {
|
||||
|
||||
'common vars' => {
|
||||
title => 'common account variables',
|
||||
body => '',
|
||||
private => 1,
|
||||
isa => [
|
||||
{
|
||||
tag => 'common vars',
|
||||
namespace => 'Account',
|
||||
},
|
||||
],
|
||||
fields => [ ],
|
||||
variables => [
|
||||
{ name => "manage_purchases_url", },
|
||||
{ name => "managePurchasesIsActive", },
|
||||
],
|
||||
related => [ ],
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
#vim:ft=perl
|
||||
24
lib/WebGUI/Help/Account_User.pm
Normal file
24
lib/WebGUI/Help/Account_User.pm
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package WebGUI::Help::Account_User;
|
||||
|
||||
use strict;
|
||||
|
||||
our $HELP = {
|
||||
'layout template' => {
|
||||
title => 'user layout template title',
|
||||
body => 'user layout template body',
|
||||
isa => [
|
||||
],
|
||||
fields => [ ],
|
||||
variables => [ ],
|
||||
related => [
|
||||
{
|
||||
tag => 'display account template',
|
||||
namespace => 'Auth',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
#vim:ft=perl
|
||||
|
|
@ -1,9 +1,6 @@
|
|||
package WebGUI::Help::Asset_Calendar;
|
||||
use strict;
|
||||
|
||||
use strict;;
|
||||
use warnings;
|
||||
|
||||
our $HELP = {
|
||||
|
||||
'view calendar template' => {
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ our $HELP = {
|
|||
description => 'helpvar useCaptcha',
|
||||
},
|
||||
{
|
||||
name => 'form.captcha',
|
||||
name => 'form_captcha',
|
||||
required => 1,
|
||||
description => 'helpvar form.captcha',
|
||||
},
|
||||
|
|
|
|||
|
|
@ -4,22 +4,28 @@ use strict;
|
|||
our $HELP = {
|
||||
|
||||
'search template' => {
|
||||
title => 'search template help title',
|
||||
body => '',
|
||||
title => 'search template help title',
|
||||
body => '',
|
||||
isa => [
|
||||
{ namespace => "Asset_Matrix",
|
||||
tag => "matrix asset template variables",
|
||||
},
|
||||
{ namespace => "Asset_Template",
|
||||
tag => "template variables",
|
||||
},
|
||||
],
|
||||
variables => [
|
||||
{ 'name' => 'CATEGORY_NAME_loop',
|
||||
{ 'name' => 'compareForm', },
|
||||
{ 'name' => 'category_loop',
|
||||
'variables' => [
|
||||
{ 'name' => 'name',
|
||||
'description' => 'listing name'
|
||||
{ 'name' => 'categoryLabel' },
|
||||
{ 'name' => 'attribute_loop',
|
||||
'variables' => [
|
||||
{ 'name' => 'label' },
|
||||
{ 'name' => 'description' },
|
||||
{ 'name' => 'form' },
|
||||
],
|
||||
},
|
||||
{ 'name' => 'fieldType' },
|
||||
{ 'name' => 'label',
|
||||
'description' => 'listing label'
|
||||
},
|
||||
{ 'name' => 'description',
|
||||
'description' => 'search field description'
|
||||
},
|
||||
{ 'name' => 'form' }
|
||||
],
|
||||
}
|
||||
],
|
||||
|
|
@ -31,27 +37,24 @@ our $HELP = {
|
|||
namespace => 'Asset_Matrix'
|
||||
},
|
||||
{ tag => 'listing detail template',
|
||||
namespace => 'Asset_Matrix'
|
||||
namespace => 'Asset_MatrixListing'
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
'compare template' => {
|
||||
title => 'comparison template help title',
|
||||
body => '',
|
||||
variables => [
|
||||
{ 'name' => 'isTooMany' },
|
||||
{ 'name' => 'isTooFew' },
|
||||
{ 'name' => 'lastupdated_loop',
|
||||
'variables' => [ { 'name' => 'lastUpdated' } ]
|
||||
title => 'comparison template help title',
|
||||
body => 'comparison template help body',
|
||||
isa => [
|
||||
{ namespace => "Asset_Matrix",
|
||||
tag => "matrix asset template variables",
|
||||
},
|
||||
{ 'name' => 'category_loop',
|
||||
'variables' => [
|
||||
{ 'name' => 'category',
|
||||
'description' => 'tmplVar category'
|
||||
},
|
||||
]
|
||||
}
|
||||
{ namespace => "Asset_Template",
|
||||
tag => "template variables",
|
||||
},
|
||||
],
|
||||
variables => [
|
||||
{ 'name' => 'javascript' },
|
||||
],
|
||||
related => [
|
||||
{ tag => 'search template',
|
||||
|
|
@ -60,20 +63,24 @@ our $HELP = {
|
|||
{ tag => 'main template',
|
||||
namespace => 'Asset_Matrix'
|
||||
},
|
||||
{ tag => 'listing detail template',
|
||||
namespace => 'Asset_Matrix'
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
'main template' => {
|
||||
title => 'matrix template help title',
|
||||
body => '',
|
||||
title => 'matrix template help title',
|
||||
body => '',
|
||||
isa => [
|
||||
{ namespace => "Asset_Matrix",
|
||||
tag => "matrix asset template variables",
|
||||
},
|
||||
{ namespace => "Asset_Template",
|
||||
tag => "template variables",
|
||||
},
|
||||
],
|
||||
variables => [
|
||||
{ 'name' => 'compare.form', },
|
||||
{ 'name' => 'search.url' },
|
||||
{ 'name' => 'compareForm', },
|
||||
{ 'name' => 'isLoggedIn' },
|
||||
{ 'name' => 'field.list.url' },
|
||||
{ 'name' => 'listAttributes_url' },
|
||||
{ 'name' => 'addMatrixListing_url' },
|
||||
{ 'name' => 'bestViews_url' },
|
||||
{ 'name' => 'bestViews_count' },
|
||||
|
|
@ -86,15 +93,9 @@ our $HELP = {
|
|||
{ 'name' => 'bestClicks_name' },
|
||||
{ 'name' => 'best_rating_loop',
|
||||
'variables' => [
|
||||
{ 'name' => 'url',
|
||||
'description' => 'tmplVar best.url'
|
||||
},
|
||||
{ 'name' => 'category',
|
||||
'description' => 'tmplVar best.category'
|
||||
},
|
||||
{ 'name' => 'name',
|
||||
'description' => 'tmplVar best.name'
|
||||
},
|
||||
{ 'name' => 'url' },
|
||||
{ 'name' => 'category' },
|
||||
{ 'name' => 'name' },
|
||||
{ 'name' => 'mean' },
|
||||
{ 'name' => 'median' },
|
||||
{ 'name' => 'count' }
|
||||
|
|
@ -102,48 +103,26 @@ our $HELP = {
|
|||
},
|
||||
{ 'name' => 'worst_rating_loop',
|
||||
'variables' => [
|
||||
{ 'name' => 'url',
|
||||
'description' => 'tmplVar worst.url'
|
||||
},
|
||||
{ 'name' => 'category',
|
||||
'description' => 'tmplVar worst.category'
|
||||
},
|
||||
{ 'name' => 'name',
|
||||
'description' => 'tmplVar worst.name'
|
||||
},
|
||||
{ 'name' => 'mean',
|
||||
'description' => 'tmplVar worst.mean'
|
||||
},
|
||||
{ 'name' => 'median',
|
||||
'description' => 'tmplVar worst.median'
|
||||
},
|
||||
{ 'name' => 'count',
|
||||
'description' => 'tmplVar worst.count'
|
||||
}
|
||||
{ 'name' => 'url' },
|
||||
{ 'name' => 'category' },
|
||||
{ 'name' => 'name' },
|
||||
{ 'name' => 'mean' },
|
||||
{ 'name' => 'median' },
|
||||
{ 'name' => 'count' }
|
||||
]
|
||||
},
|
||||
{ 'name' => 'last_update_loop',
|
||||
{ 'name' => 'last_updated_loop',
|
||||
'variables' => [
|
||||
{ 'name' => 'url',
|
||||
'description' => 'tmplVar last.url'
|
||||
},
|
||||
{ 'name' => 'name',
|
||||
'description' => 'tmplVar last.name'
|
||||
},
|
||||
{ 'name' => 'lastUpdated',
|
||||
'description' => 'tmplVar last.lastUpdated'
|
||||
}
|
||||
{ 'name' => 'url' },
|
||||
{ 'name' => 'name' },
|
||||
{ 'name' => 'lastUpdated' },
|
||||
]
|
||||
},
|
||||
{ 'name' => 'listingCount' },
|
||||
{ 'name' => 'pending_loop',
|
||||
'variables' => [
|
||||
{ 'name' => 'url',
|
||||
'description' => 'tmplVar pending.url'
|
||||
},
|
||||
{ 'name' => 'name',
|
||||
'description' => 'tmplVar pending.name'
|
||||
}
|
||||
{ 'name' => 'url' },
|
||||
{ 'name' => 'name' },
|
||||
]
|
||||
}
|
||||
],
|
||||
|
|
@ -154,69 +133,26 @@ our $HELP = {
|
|||
{ tag => 'compare template',
|
||||
namespace => 'Asset_Matrix'
|
||||
},
|
||||
{ tag => 'listing detail template',
|
||||
namespace => 'Asset_Matrix'
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
'listing detail template' => {
|
||||
title => 'detail template help title',
|
||||
body => '',
|
||||
variables => [
|
||||
{ 'name' => 'discussion' },
|
||||
{ 'name' => 'screenshot',
|
||||
'description' => 'tmplVar screenshot'
|
||||
'matrix asset template variables' => {
|
||||
private => 1,
|
||||
title => 'matrix asset template variables title',
|
||||
body => '',
|
||||
isa => [
|
||||
{ namespace => "Asset_Wobject",
|
||||
tag => "wobject template variables",
|
||||
},
|
||||
{ 'name' => 'thumbnail' },
|
||||
{ 'name' => 'emailForm' },
|
||||
{ 'name' => 'emailSent' },
|
||||
{ 'name' => 'isPending' },
|
||||
{ 'name' => 'lastUpdated_epoch' },
|
||||
{ 'name' => 'lastUpdated_date' },
|
||||
{ 'name' => 'id' },
|
||||
{ 'name' => 'description',
|
||||
'description' => 'listing description'
|
||||
},
|
||||
{ 'name' => 'productName' },
|
||||
{ 'name' => 'productUrl' },
|
||||
{ 'name' => 'productUrl_click' },
|
||||
{ 'name' => 'manufacturerName' },
|
||||
{ 'name' => 'manufacturerUrl' },
|
||||
{ 'name' => 'manufacturerUrl_click' },
|
||||
{ 'name' => 'versionNumber' },
|
||||
{ 'name' => 'views' },
|
||||
{ 'name' => 'compares' },
|
||||
{ 'name' => 'clicks' },
|
||||
{ 'name' => 'ratings' },
|
||||
{ 'name' => 'CATEGORY_NAME_loop',
|
||||
'variables' => [
|
||||
{ 'name' => 'value', },
|
||||
{ 'name' => 'name',
|
||||
'description' => 'tmplVar name'
|
||||
},
|
||||
{ 'name' => 'label' },
|
||||
{ 'name' => 'description',
|
||||
'description' => 'category listing description'
|
||||
},
|
||||
{ 'name' => 'category',
|
||||
'description' => 'tmplVar category'
|
||||
},
|
||||
{ 'name' => 'class',
|
||||
'description' => 'tmplVar class'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
fields => [],
|
||||
variables => [],
|
||||
related => [
|
||||
{ tag => 'search template',
|
||||
namespace => 'Asset_Matrix'
|
||||
{ tag => 'listing detail template',
|
||||
namespace => 'Asset_MatrixListing'
|
||||
},
|
||||
{ tag => 'compare template',
|
||||
namespace => 'Asset_Matrix'
|
||||
},
|
||||
{ tag => 'main template',
|
||||
namespace => 'Asset_Matrix'
|
||||
{ tag => 'edit listing template',
|
||||
namespace => 'Asset_MatrixListing'
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
|||
95
lib/WebGUI/Help/Asset_MatrixListing.pm
Normal file
95
lib/WebGUI/Help/Asset_MatrixListing.pm
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
package WebGUI::Help::Asset_MatrixListing;
|
||||
use strict;
|
||||
|
||||
our $HELP = {
|
||||
'listing detail template' => {
|
||||
title => 'detail template help title',
|
||||
body => '',
|
||||
isa => [
|
||||
{ namespace => "Asset_Template",
|
||||
tag => "template variables",
|
||||
},
|
||||
{ tag => 'asset template asset variables',
|
||||
namespace => 'Asset'
|
||||
},
|
||||
],
|
||||
variables => [
|
||||
{ 'name' => 'screenshots' },
|
||||
{ 'name' => 'emailForm' },
|
||||
{ 'name' => 'emailSent' },
|
||||
{ 'name' => 'lastUpdated_epoch' },
|
||||
{ 'name' => 'lastUpdated_date' },
|
||||
{ 'name' => 'description' },
|
||||
{ 'name' => 'productName' },
|
||||
{ 'name' => 'productUrl' },
|
||||
{ 'name' => 'productUrl_click' },
|
||||
{ 'name' => 'manufacturerName',
|
||||
description => 'manufacturerName description'
|
||||
},
|
||||
{ 'name' => 'manufacturerUrl' },
|
||||
{ 'name' => 'manufacturerUrl_click' },
|
||||
{ 'name' => 'version' },
|
||||
{ 'name' => 'views' },
|
||||
{ 'name' => 'compares' },
|
||||
{ 'name' => 'clicks' },
|
||||
{ 'name' => 'ratings' },
|
||||
{ 'name' => 'CATEGORY_NAME_loop',
|
||||
'variables' => [
|
||||
{ 'name' => 'categoryLabel' },
|
||||
{ 'name' => 'attribute_loop',
|
||||
'variables' => [
|
||||
{ 'name' => 'label' },
|
||||
{ 'name' => 'value' },
|
||||
{ 'name' => 'fieldType' },
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
related => [
|
||||
{ tag => 'search template',
|
||||
namespace => 'Asset_Matrix'
|
||||
},
|
||||
{ tag => 'compare template',
|
||||
namespace => 'Asset_Matrix'
|
||||
},
|
||||
{ tag => 'main template',
|
||||
namespace => 'Asset_Matrix'
|
||||
},
|
||||
{ tag => 'edit listing template',
|
||||
namespace => 'Asset_MatrixListing'
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
'edit listing template' => {
|
||||
title => 'edit listing template help title',
|
||||
body => '',
|
||||
isa => [
|
||||
{ namespace => "Asset_Template",
|
||||
tag => "template variables",
|
||||
},
|
||||
{ tag => 'asset template asset variables',
|
||||
namespace => 'Asset'
|
||||
},
|
||||
],
|
||||
variables => [
|
||||
{ 'name' => 'form', }
|
||||
],
|
||||
related => [
|
||||
{ tag => 'search template',
|
||||
namespace => 'Asset_Matrix'
|
||||
},
|
||||
{ tag => 'compare template',
|
||||
namespace => 'Asset_Matrix'
|
||||
},
|
||||
{ tag => 'main template',
|
||||
namespace => 'Asset_Matrix'
|
||||
},
|
||||
{ tag => 'listing detail template',
|
||||
namespace => 'Asset_MatrixListing'
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue