Merge branch 'master' into survey

* master: (121 commits)
  Fix a POD typo.
  correct inbox message from user preface
  Fix a typo in the Default gallery view template
  Documentation bug in buildArrayRefOfHashRefs
  changed screenshots in Matrix Listing view to popup
  matrix privileging fixes
  Fix an i18n typo in the Post user defined variables.
  Remove debugging code.
  approval workflow fix
  matrix upgrade and privileging fixes
  fixed: Template parser cannot be set
  forward porting gallery bug fixes
  preparing for 7.7.0 dev
  parser should be a selectbox, not a selectlist.
  labeling survey as beta
  fixeding my borkes to the changelog
  fixed #9852: Users can accept private messages from Visitor, but Visitor cannot send messages
  preparing for 7.6.14 release
  fix AdSpace, Ad tests
  Restore the original properties for the profile category that was modified for test.
  ...

Conflicts:
	docs/gotcha.txt
	docs/upgrades/upgrade_7.6.10-7.6.11.pl
	lib/WebGUI/Asset/Wobject/Survey.pm
	lib/WebGUI/Asset/Wobject/Survey/SurveyJSON.pm
This commit is contained in:
Patrick Donelan 2009-03-11 15:26:07 +11:00
commit 7ec5cab126
713 changed files with 4994 additions and 3058 deletions

View file

@ -1,7 +1,7 @@
package WebGUI::Asset::Wobject::Article;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using

View file

@ -3,7 +3,7 @@ package WebGUI::Asset::Wobject::Calendar;
use strict;
#----------------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#----------------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using

View file

@ -1,7 +1,7 @@
package WebGUI::Asset::Wobject::Collaboration;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using

View file

@ -1,7 +1,7 @@
package WebGUI::Asset::Wobject::Collaboration::Newsletter;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using

View file

@ -1,7 +1,7 @@
package WebGUI::Asset::Wobject::Dashboard;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using

View file

@ -3,7 +3,7 @@ package WebGUI::Asset::Wobject::DataForm;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2008 Plain Black Corporation.
WebGUI is Copyright 2001-2009 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
@ -484,9 +484,7 @@ sub deleteAttachedFiles {
my $form = $self->_createForm($fieldConfig->{$field}, $entryData->{$field});
if ($form->can('getStorageLocation')) {
my $storage = $form->getStorageLocation;
if ($storage) {
$storage->delete;
}
$storage->delete if $storage;
}
}
}
@ -498,7 +496,7 @@ sub deleteAttachedFiles {
my $form = $self->_createForm($fieldConfig->{$field}, $entryData->{$field});
if ($form->can('getStorageLocation')) {
my $storage = $form->getStorageLocation;
$storage->delete;
$storage->delete if $storage;
}
}
}
@ -512,7 +510,7 @@ sub getAttachedFiles {
my $fieldConfig = $self->getFieldConfig;
my @paths;
for my $field ( values %{$fieldConfig} ) {
my $form = $self->_createForm($field, $entryData->{$field->{name}});
my $form = $self->_createForm($field, $entryData->field($field->{name}));
if ($form->can('getStorageLocation')) {
my $storage = $form->getStorageLocation;
if ($storage) {
@ -648,6 +646,7 @@ sub getRecordTemplateVars {
$var->{'edit.URL' } = $self->getFormUrl('entryId=' . $entryId);
$var->{'delete.url' } = $self->getUrl('func=deleteEntry;entryId=' . $entryId);
$var->{'delete.label' } = $i18n->get(90);
$var->{'entryId' } = $entryId;
}
my $func = $session->form->process('func');
my $ignoreForm = $func eq 'editSave' || $func eq 'editFieldSave';
@ -1521,8 +1520,8 @@ sub www_process {
unless $self->canView;
my $session = $self->session;
my $i18n = WebGUI::International->new($session,"Asset_DataForm");
my $entryId = $self->session->form->process('entryId');
my $entry = $self->entryClass->new($self, ( $entryId ? $entryId : () ) );
my $entryId = $session->form->process('entryId');
my $entry = $self->entryClass->new($self, ( $entryId ? $entryId : () ) );
my $var = $self->getTemplateVars;

View file

@ -3,7 +3,7 @@ package WebGUI::Asset::Wobject::DataTable;
$VERSION = "1.0.0";
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using

View file

@ -3,7 +3,7 @@ package WebGUI::Asset::Wobject::EventManagementSystem;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2008 Plain Black Corporation.
WebGUI is Copyright 2001-2009 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
@ -573,7 +573,7 @@ sub www_editBadgeGroup {
my ($form, $db) = $self->session->quick(qw(form db));
my $f = WebGUI::HTMLForm->new($self->session, action=>$self->getUrl);
my $badgeGroup = $db->getRow("EMSBadgeGroup","badgeGroupId",$form->get('badgeGroupId'));
$badgeGroup->{badgeList} = ($badgeGroup->{badgeList} ne "") ? JSON::decode_json($badgeGroup->{badgeList}) : [];
$badgeGroup->{badgeList} = ($badgeGroup->{badgeList} ne "") ? JSON::from_json($badgeGroup->{badgeList}) : [];
my $i18n = WebGUI::International->new($self->session, "Asset_EventManagementSystem");
$f->hidden(name=>'func', value=>'editBadgeGroupSave');
$f->hidden(name=>'badgeGroupId', value=>$form->get('badgeGroupId'));
@ -842,7 +842,7 @@ sub www_getBadgesAsJson {
$results{'sort'} = undef;
$results{'dir'} = "asc";
$session->http->setMimeType('application/json');
return JSON->new->utf8->encode(\%results);
return JSON->new->encode(\%results);
}
#-------------------------------------------------------------------
@ -974,7 +974,7 @@ sub www_getRegistrantAsJson {
$badgeInfo->{ribbons} = \@ribbons;
# build json datasource
return JSON->new->utf8->encode($badgeInfo);
return JSON->new->encode($badgeInfo);
}
#-------------------------------------------------------------------
@ -1038,7 +1038,7 @@ sub www_getRegistrantsAsJson {
# build json datasource
$session->http->setMimeType('application/json');
return JSON->new->utf8->encode(\%results);
return JSON->new->encode(\%results);
}
@ -1073,7 +1073,7 @@ sub www_getRibbonsAsJson {
$results{'sort'} = undef;
$results{'dir'} = "asc";
$session->http->setMimeType('application/json');
return JSON->new->utf8->encode(\%results);
return JSON->new->encode(\%results);
}
@ -1184,7 +1184,7 @@ className='WebGUI::Asset::Sku::EMSTicket' and state='published' and revisionDate
my $description = $ticket->get('description');
my $data = $ticket->get('eventMetaData');
$data = '{}' if ($data eq "");
my $meta = JSON->new->utf8->decode($data);
my $meta = JSON->new->decode($data);
foreach my $field (@{$self->getEventMetaFields}) {
my $label = $field->{label};
if ($field->{visible} && $meta->{$label} ne "") {
@ -1228,7 +1228,7 @@ className='WebGUI::Asset::Sku::EMSTicket' and state='published' and revisionDate
$results{'sort'} = undef;
$results{'dir'} = "asc";
$session->http->setMimeType('application/json');
return JSON->new->utf8->encode(\%results);
return JSON->new->encode(\%results);
}
@ -1263,7 +1263,7 @@ sub www_getTokensAsJson {
$results{'sort'} = undef;
$results{'dir'} = "asc";
$session->http->setMimeType('application/json');
return JSON->new->utf8->encode(\%results);
return JSON->new->encode(\%results);
}
#-------------------------------------------------------------------

View file

@ -3,7 +3,7 @@ package WebGUI::Asset::Wobject::Folder;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2008 Plain Black Corporation.
WebGUI is Copyright 2001-2009 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using

View file

@ -1,7 +1,7 @@
package WebGUI::Asset::Wobject::Gallery;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
@ -1104,6 +1104,7 @@ sub www_addAlbumService {
description => $form->get('synopsis','textarea'),
synopsis => $form->get('synopsis','textarea'),
othersCanAdd => $form->get('othersCanAdd','yesNo'),
ownerUserId => $session->user->userId,
});
$album->requestAutoCommit;

View file

@ -1,7 +1,7 @@
package WebGUI::Asset::Wobject::GalleryAlbum;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
@ -537,7 +537,7 @@ sub getTemplateVars {
# Add some specific vars from the Gallery
my $galleryVar = $gallery->getTemplateVars;
for my $key ( qw{ title menuTitle url } ) {
for my $key ( qw{ title menuTitle url displayTitle } ) {
$var->{ "gallery_" . $key } = $galleryVar->{ $key };
}
@ -647,7 +647,8 @@ sub prepareView {
= WebGUI::Asset::Template->new($self->session, $templateId);
$template->prepare($self->getMetaDataAsTemplateVariables);
$self->{_viewTemplate} = $template;
$self->{_viewTemplate} = $template;
$self->{_viewVariables} = $self->getTemplateVars;
}
#----------------------------------------------------------------------------
@ -776,7 +777,7 @@ to be displayed within the page style.
sub view {
my $self = shift;
my $session = $self->session;
my $var = $self->getTemplateVars;
my $var = delete $self->{_viewVariables};
my $p = $self->getFilePaginator;
$p->appendTemplateVars( $var );
@ -1018,6 +1019,7 @@ sub www_addFileService {
title => $form->get('title','text'),
description => $form->get('synopsis','textarea'),
synopsis => $form->get('synopsis','textarea'),
ownerUserId => $session->user->userId,
});
my $storage = $file->getStorageLocation;

View file

@ -1,7 +1,7 @@
package WebGUI::Asset::Wobject::HttpProxy;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using

View file

@ -5,7 +5,7 @@ use strict;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2008 Plain Black Corporation.
WebGUI is Copyright 2001-2009 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using

View file

@ -3,7 +3,7 @@ package WebGUI::Asset::Wobject::Layout;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2008 Plain Black Corporation.
WebGUI is Copyright 2001-2009 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using

View file

@ -4,7 +4,7 @@ use strict;
our $VERSION = "2.0.0";
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
@ -30,10 +30,46 @@ Returns true if able to add MatrixListings.
sub canAddMatrixListing {
my $self = shift;
my $user = $self->session->user;
return 0 if $self->session->user->isVisitor;
# Users in the groupToAdd group can add listings
if ( $user->isInGroup( $self->get("groupToAdd") ) ) {
return 1;
}
# Users who can edit matrix can add listings
else {
return $self->canEdit;
}
return 1;
}
#----------------------------------------------------------------------------
=head2 canEdit ( [userId] )
Returns true if the user can edit this Matrix.
Also checks if a user is adding a Matrix Listing and allows them to if they are
part of the C<groupToAdd> group.
=cut
sub canEdit {
my $self = shift;
my $userId = shift || $self->session->user->userId;
my $form = $self->session->form;
if ( $form->get('func') eq "editSave" && $form->get('assetId') eq "new" && $form->get( 'class' )->isa(
'WebGUI::Asset::MatrixListing' ) ) {
return $self->canAddMatrixListing();
}
else {
if ($userId eq $self->get("ownerUserId")) {
return 1;
}
my $user = WebGUI::User->new($self->session, $userId);
return $user->isInGroup($self->get("groupIdEdit"));
}
}
#-------------------------------------------------------------------
@ -94,6 +130,22 @@ sub definition {
hoverHelp =>$i18n->get('edit listing template description'),
label =>$i18n->get('edit listing template label'),
},
screenshotsTemplateId=>{
defaultValue =>"matrixtmpl000000000006",
fieldType =>"template",
tab =>"display",
namespace =>"Matrix/Screenshots",
hoverHelp =>$i18n->get('screenshots template description'),
label =>$i18n->get('screenshots template label'),
},
screenshotsConfigTemplateId=>{
defaultValue =>"matrixtmpl000000000007",
fieldType =>"template",
tab =>"display",
namespace =>"Matrix/ScreenshotsConfig",
hoverHelp =>$i18n->get('screenshots config template description'),
label =>$i18n->get('screenshots config template label'),
},
defaultSort=>{
fieldType =>"selectBox",
tab =>"display",
@ -101,7 +153,7 @@ sub definition {
score => $i18n->get('sort by score label'),
title => $i18n->get('sort alpha numeric label'),
lineage => $i18n->get('sort by asset rank label'),
revisionDate => $i18n->get('sort by last updated label'),
lastUpdated => $i18n->get('sort by last updated label'),
},
defaultValue =>"score",
hoverHelp =>$i18n->get('default sort description'),
@ -164,6 +216,13 @@ sub definition {
hoverHelp =>$i18n->get('max comparisons privileged description'),
label =>$i18n->get('max comparisons privileged label'),
},
groupToAdd=>{
fieldType =>"group",
tab =>"security",
defaultValue =>2,
hoverHelp =>$i18n->get('group to add description'),
label =>$i18n->get('group to add label'),
},
submissionApprovalWorkflowId=>{
fieldType =>"workflow",
tab =>"security",
@ -442,6 +501,8 @@ sub view {
# javascript and css files for compare form datatable
$self->session->style->setLink($self->session->url->extras('yui/build/datatable/assets/skins/sam/datatable.css'),
{type =>'text/css', rel=>'stylesheet'});
$self->session->style->setScript($self->session->url->extras('yui/build/yahoo-dom-event/yahoo-dom-event.js'), {type =>
'text/javascript'});
$self->session->style->setScript($self->session->url->extras('yui/build/json/json-min.js'), {type =>
'text/javascript'});
$self->session->style->setScript($self->session->url->extras('yui/build/connection/connection-min.js'), {type =>
@ -516,7 +577,8 @@ sub view {
my @lastUpdatedListings = @{ $self->getLineage(['descendants'], {
includeOnlyClasses => ['WebGUI::Asset::MatrixListing'],
orderByClause => "revisionDate desc",
joinClass => "WebGUI::Asset::MatrixListing",
orderByClause => "lastUpdated desc",
limit => 5,
returnObjects => 1,
}) };
@ -524,7 +586,7 @@ sub view {
push (@{ $var->{last_updated_loop} }, {
url => $lastUpdatedListing->getUrl,
name => $lastUpdatedListing->get('title'),
lastUpdated => $self->session->datetime->epochToHuman($lastUpdatedListing->get('revisionDate'),"%z")
lastUpdated => $self->session->datetime->epochToHuman($lastUpdatedListing->get('lastUpdated'),"%z")
});
}
$var->{lastUpdated_sortButton} = "<span id='sortByUpdated'><button type='button'>Sort by updated</button></span><br />";
@ -540,7 +602,8 @@ sub view {
}) };
foreach my $pendingListing (@pendingListings){
push (@{ $var->{pending_loop} }, {
url => $pendingListing->getUrl,
url => $pendingListing->getUrl
."?func=view;revision=".$pendingListing->get('revisionDate'),
name => $pendingListing->get('title'),
});
}
@ -931,57 +994,57 @@ sub www_getCompareFormData {
listing.compares,
listing.clicks,
listing.lastUpdated
from MatrixListing as listing
left join asset on listing.assetId = asset.assetId
left join assetData on assetData.assetId = listing.assetId and listing.revisionDate =
from asset
left join assetData using(assetId)
left join MatrixListing as listing on listing.assetId = assetData.assetId and listing.revisionDate =
assetData.revisionDate
where
asset.parentId=?
and asset.state='published'
and asset.className='WebGUI::Asset::MatrixListing'
and assetData.revisionDate=(
select
max(revisionDate)
from
assetData
where
assetData.assetId=asset.assetId
and (status='approved' or status='archived')
)
and assetData.revisionDate = (SELECT max(revisionDate) from assetData where assetId=asset.assetId and status='approved')
and status='approved'
group by
assetData.assetId
order by ".$sort.$sortDirection;
@results = @{ $session->db->buildArrayRefOfHashRefs($sql,[$self->getId]) };
my (@searchParams,@searchParams_sorted);
if($form->process("search")){
foreach my $param ($form->param) {
if($param =~ m/^search_/){
my $parameter;
$parameter->{name} = $param;
$parameter->{value} = $form->process($param);
my $attributeId = $param;
$attributeId =~ s/^search_//;
$attributeId =~ s/_____/-/g;
$parameter->{attributeId} = $attributeId;
push(@searchParams,$parameter);
}
}
}
@searchParams_sorted = sort { $b->{value} <=> $a->{value} } @searchParams;
foreach my $result (@results){
if($form->process("search")){
# $self->session->errorHandler->warn("checking listing: ".$result->{title});
my $matrixListing_attributes = $session->db->buildHashRefOfHashRefs("
select value, fieldType, attributeId from MatrixListing_attribute as listing
left join Matrix_attribute using(attributeId)
where listing.matrixListingId = ?
",[$result->{assetId}],'attributeId');
foreach my $param ($form->param) {
if($param =~ m/^search_/){
my $attributeId = $param;
$attributeId =~ s/^search_//;
$attributeId =~ s/_____/-/;
my $fieldType = $matrixListing_attributes->{$attributeId}->{fieldType};
my $listingValue = $matrixListing_attributes->{$attributeId}->{value};
# $self->session->errorHandler->warn("fieldType:".$fieldType.", attributeValue: ".$form->process($param).", listingvalue: ".$listingValue);
if(($fieldType eq 'MatrixCompare') && ($listingValue < $form->process($param))){
select value, fieldType, attributeId from Matrix_attribute
left join MatrixListing_attribute as listing using(attributeId)
where listing.matrixListingId = ? order by value asc",
[$result->{assetId}],'attributeId');
PARAM: foreach my $param (@searchParams_sorted) {
my $fieldType = $matrixListing_attributes->{$param->{attributeId}}->{fieldType};
my $listingValue = $matrixListing_attributes->{$param->{attributeId}}->{value};
if(($fieldType eq 'MatrixCompare') && ($listingValue < $param->{value})){
$result->{checked} = '';
last;
last PARAM;
}
elsif(($fieldType ne 'MatrixCompare') && ($form->process($param) ne $listingValue)){
elsif(($fieldType ne 'MatrixCompare' && $fieldType ne '') && ($param->{value} ne $listingValue)){
$result->{checked} = '';
last;
last PARAM;
}
else{
$result->{checked} = 'checked';
}
}
}
}
else{
@ -993,11 +1056,11 @@ assetData.revisionDate
$result->{assetId} =~ s/-/_____/g;
$result->{url} = $session->url->gateway($result->{url});
}
my $jsonOutput;
$jsonOutput->{ResultSet} = {Result=>\@results};
return JSON->new->utf8->encode($jsonOutput);
my $encodedOutput = JSON->new->encode($jsonOutput);
return $encodedOutput;
}
#-------------------------------------------------------------------
@ -1023,8 +1086,8 @@ sub www_getCompareListData {
unless (scalar(@listingIds)) {
@listingIds = $self->session->form->checkList("listingId");
}
my @responseFields = ("attributeId", "name", "description","fieldType", "checked");
foreach my $listingId (@listingIds){
$listingId =~ s/_____/-/g;
my $listing = WebGUI::Asset::MatrixListing->new($session,$listingId);
@ -1038,30 +1101,34 @@ sub www_getCompareListData {
url =>$listing->getUrl,
lastUpdated =>$session->datetime->epochToHuman( $listing->get('revisonDate'),"%z" ),
});
push(@responseFields, $listingId_safe, $listingId_safe."_compareColor");
}
push(@results,{name=>$i18n->get('last updated label'),fieldType=>'lastUpdated'});
my $jsonOutput;
$jsonOutput->{ColumnDefs} = \@columnDefs;
$jsonOutput->{ColumnDefs} = \@columnDefs;
$jsonOutput->{ResponseFields} = \@responseFields;
foreach my $category (keys %{$self->getCategories}) {
push(@results,{name=>$category,fieldType=>'category'});
my $fields = " a.name, a.fieldType, a.attributeId, a.description ";
my $from = "from Matrix_attribute a";
my $tableCount = "b";
my $where;
foreach my $listingId (@listingIds) {
my $listingId_safe = $listingId;
$listingId_safe =~ s/-/_____/g;
$fields .= ", ".$tableCount.".value as `$listingId_safe`";
$from .= " left join MatrixListing_attribute ".$tableCount." on a.attributeId="
.$tableCount.".attributeId and ".$tableCount.".matrixListingId=? ";
$from .= " left join MatrixListing_attribute ".$tableCount." on a.attributeId=".$tableCount.".attributeId";
$where .= "and ".$tableCount.".matrixListingId=?";
$tableCount++;
}
push(@results, @{ $self->session->db->buildArrayRefOfHashRefs(
"select $fields $from where a.category=? and a.assetId=? order by a.name",
[@listingIds,$category,$self->getId]
"select $fields $from where a.category=? and a.assetId=? ".$where." order by a.name",
[$category,$self->getId,@listingIds]
) });
}
foreach my $result (@results){
if($result->{fieldType} eq 'category'){
# Row starting with a category label shows the listing name in each column
@ -1097,10 +1164,9 @@ sub www_getCompareListData {
}
$jsonOutput->{ResultSet} = {Result=>\@results};
$session->http->setMimeType("application/json");
return JSON->new->utf8->encode($jsonOutput);
return JSON->new->encode($jsonOutput);
}
#-------------------------------------------------------------------
@ -1143,6 +1209,7 @@ sub www_search {
my $self = shift;
my $var = $self->get;
my $db = $self->session->db;
$var->{compareForm} = $self->getCompareForm;
$self->session->style->setScript($self->session->url->extras('yui/build/yahoo/yahoo-min.js'),
@ -1174,7 +1241,7 @@ sub www_search {
my $attributes;
my @attribute_loop;
my $categoryLoopName = $self->session->url->urlize($category)."_loop";
$attributes = $self->session->db->read("select * from Matrix_attribute where category =? and assetId = ?",
$attributes = $db->read("select * from Matrix_attribute where category =? and assetId = ?",
[$category,$self->getId]);
while (my $attribute = $attributes->hashRef) {
$attribute->{label} = $attribute->{name};
@ -1183,10 +1250,14 @@ sub www_search {
$attribute->{extras} = " class='attributeSelect'";
if($attribute->{fieldType} eq 'Combo'){
$attribute->{fieldType} = 'SelectBox';
}
if($attribute->{fieldType} eq 'SelectBox'){
$attribute->{options} = "blank\n".$attribute->{options};
my %options;
tie %options, 'Tie::IxHash';
%options = $db->buildHash('select value, value from MatrixListing_attribute
where attributeId = ? order by value',[$attribute->{attributeId}]);
$options{'blank'} = 'blank';
$attribute->{options} = \%options;
$attribute->{value} = 'blank';
$attribute->{extras} = "style='width:120px'";
}
$attribute->{form} = WebGUI::Form::DynamicField->new($self->session,%{$attribute})->toHtml;
push(@attribute_loop,$attribute);

View file

@ -1,7 +1,7 @@
package WebGUI::Asset::Wobject::MessageBoard;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using

View file

@ -3,7 +3,7 @@ package WebGUI::Asset::Wobject::MultiSearch;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2008 Plain Black Corporation.
WebGUI is Copyright 2001-2009 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using

View file

@ -1,7 +1,7 @@
package WebGUI::Asset::Wobject::Navigation;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using

View file

@ -2,7 +2,7 @@ package WebGUI::Asset::Wobject::Poll;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using

View file

@ -4,7 +4,7 @@ use strict;
our $VERSION = "1.0.0";
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using

View file

@ -1,7 +1,7 @@
package WebGUI::Asset::Wobject::SQLReport;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using

View file

@ -1,7 +1,7 @@
package WebGUI::Asset::Wobject::Search;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using

View file

@ -1,7 +1,7 @@
package WebGUI::Asset::Wobject::Shelf;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using

View file

@ -1,7 +1,7 @@
package WebGUI::Asset::Wobject::StockData;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using

View file

@ -1,7 +1,7 @@
package WebGUI::Asset::Wobject::Survey;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using

View file

@ -3,7 +3,7 @@ package WebGUI::Asset::Wobject::Survey::ResponseJSON;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2008 Plain Black Corporation.
WebGUI is Copyright 2001-2009 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using

View file

@ -3,7 +3,7 @@ package WebGUI::Asset::Wobject::Survey::SurveyJSON;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2008 Plain Black Corporation.
WebGUI is Copyright 2001-2009 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
@ -89,7 +89,7 @@ my %MULTI_CHOICE_BUNDLES = (
Likelihood => [ 'Not at all likely', (q{}) x 9, 'Extremely likely' ],
'Oppose/Support' => [ 'Strongly oppose', (q{}) x 5, 'Strongly support' ],
Party =>
[ 'Democratic party', 'Republican party (or GOP)', 'Independant party', 'Other party (verbatim)' ],
[ 'Democratic party', 'Republican party (or GOP)', 'Independent party', 'Other party (verbatim)' ],
Race =>
[ 'American Indian', 'Asian', 'Black', 'Hispanic', 'White non-Hispanic', 'Something else (verbatim)' ],
Risk => [ 'No risk', (q{}) x 9, 'Extreme risk' ],

View file

@ -1,7 +1,7 @@
package WebGUI::Asset::Wobject::SyndicatedContent;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using

View file

@ -1,7 +1,7 @@
package WebGUI::Asset::Wobject::Thingy;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
@ -130,13 +130,13 @@ sub addThing {
}
$db->write("create table ".$db->dbh->quote_identifier("Thingy_".$newThingId)."(
thingDataId varchar(22) binary not null,
thingDataId CHAR(22) binary not null,
dateCreated int not null,
createdById varchar(22) not null,
updatedById varchar(22) not null,
updatedByName varchar(255) not null,
createdById CHAR(22) not null,
updatedById CHAR(22) not null,
updatedByName CHAR(255) not null,
lastUpdated int not null,
ipAddress varchar(255),
ipAddress CHAR(255),
primary key (thingDataId)
) ENGINE=MyISAM DEFAULT CHARSET=utf8");
@ -591,7 +591,7 @@ sub _getDbDataType {
my ($dbDataType, $formClass);
if ($fieldType =~ m/^otherThing/x){
$dbDataType = "varchar(22)";
$dbDataType = "CHAR(22)";
}
else{
$formClass = 'WebGUI::Form::' . ucfirst $fieldType;
@ -1517,7 +1517,7 @@ sub www_deleteThingDataViaAjax {
unless ($thingId && $thingDataId) {
$session->http->setStatus("400", "Bad Request");
return JSON->new->utf8->encode({message => "Can't get thing data without a thingId and a thingDataId."});
return JSON->new->encode({message => "Can't get thing data without a thingId and a thingDataId."});
}
my $thingProperties = $self->getThing($thingId);
@ -1528,11 +1528,11 @@ sub www_deleteThingDataViaAjax {
$self->deleteThingData($thingId,$thingDataId);
$session->http->setMimeType("application/json");
return JSON->new->utf8->encode({message => "Data with thingDataId $thingDataId was deleted."});
return JSON->new->encode({message => "Data with thingDataId $thingDataId was deleted."});
}
else {
$session->http->setStatus("404", "Not Found");
return JSON->new->utf8->encode({message => "The thingId you specified can not be found."});
return JSON->new->encode({message => "The thingId you specified can not be found."});
}
}
@ -2455,7 +2455,7 @@ sub www_editThingDataSaveViaAjax {
unless ($thingId && $thingDataId) {
$session->http->setStatus("400", "Bad Request");
return JSON->new->utf8->encode({message => "Can't get thing data without a thingId and a thingDataId."});
return JSON->new->encode({message => "Can't get thing data without a thingId and a thingDataId."});
}
my $thingProperties = $self->getThing($thingId);
@ -2467,19 +2467,19 @@ sub www_editThingDataSaveViaAjax {
if($thingDataId eq 'new' && $self->hasEnteredMaxPerUser($thingId)){
$session->http->setStatus("400", "Bad Request");
return JSON->new->utf8->encode({message => $i18n->get("has entered max per user message")});
return JSON->new->encode({message => $i18n->get("has entered max per user message")});
}
my ($newThingDataId,$errors) = $self->editThingDataSave($thingId,$thingDataId);
if ($errors){
$session->http->setStatus("400", "Bad Request");
return JSON->new->utf8->encode($errors);
return JSON->new->encode($errors);
}
}
else {
$session->http->setStatus("404", "Not Found");
return JSON->new->utf8->encode({message => "The thingId you requested can not be found."});
return JSON->new->encode({message => "The thingId you requested can not be found."});
}
}
@ -2568,7 +2568,7 @@ sub www_getThingViaAjax {
unless ($thingId) {
$session->http->setStatus("400", "Bad Request");
return JSON->new->utf8->encode({message => "Can't return thing properties without a thingId."});
return JSON->new->encode({message => "Can't return thing properties without a thingId."});
}
my $thingProperties = $self->getThing($thingId);
@ -2586,11 +2586,11 @@ sub www_getThingViaAjax {
$thingProperties->{field_loop} = \@field_loop;
$session->http->setMimeType("application/json");
return JSON->new->utf8->encode($thingProperties);
return JSON->new->encode($thingProperties);
}
else {
$session->http->setStatus("404", "Not Found");
return JSON->new->utf8->encode({message => "The thingId you requested can not be found."});
return JSON->new->encode({message => "The thingId you requested can not be found."});
}
}
@ -2620,11 +2620,11 @@ sub www_getThingsViaAjax {
}
}
if (scalar @visibleThings > 0){
return JSON->new->utf8->encode(\@visibleThings);
return JSON->new->encode(\@visibleThings);
}
else {
$session->http->setStatus("404", "Not Found");
return JSON->new->utf8->encode({message => "No visible Things were found in this Thingy."});
return JSON->new->encode({message => "No visible Things were found in this Thingy."});
}
}
@ -2982,7 +2982,7 @@ sub www_searchViaAjax {
unless ($thingId) {
$session->http->setStatus("400", "Bad Request");
return JSON->new->utf8->encode({message => "Can't perform search without a thingId."});
return JSON->new->encode({message => "Can't perform search without a thingId."});
}
if ($thingProperties->{thingId}){
@ -2993,11 +2993,11 @@ sub www_searchViaAjax {
my $var = $self->getSearchTemplateVars($thingId,$thingProperties);
$session->http->setMimeType("application/json");
return JSON->new->utf8->encode($var);
return JSON->new->encode($var);
}
else {
$session->http->setStatus("404", "Not Found");
return JSON->new->utf8->encode({message => "The thingId you requested can not be found."});
return JSON->new->encode({message => "The thingId you requested can not be found."});
}
}
@ -3154,7 +3154,7 @@ sequenceNumber');
WebGUI::Cache->new($self->session,"query_".$thingId)->set($query,30*60);
$paginatePage = $self->session->form->param('pn') || 1;
$currentUrl .= ";orderBy=".$orderBy if ($orderBy);
$currentUrl = $self->session->url->append($currentUrl, "orderBy=".$orderBy) if $orderBy;
$p = WebGUI::Paginator->new($self->session,$currentUrl,$thingProperties->{thingsPerPage}, undef, $paginatePage);
@ -3393,7 +3393,7 @@ sub www_viewThingDataViaAjax {
unless ($thingId && $thingDataId) {
$session->http->setStatus("400", "Bad Request");
return JSON->new->utf8->encode({message => "Can't get thing data without a thingId and a thingDataId."});
return JSON->new->encode({message => "Can't get thing data without a thingId and a thingDataId."});
}
my $thingProperties = $self->getThing($thingId);
@ -3404,16 +3404,16 @@ sub www_viewThingDataViaAjax {
my $output = $self->getViewThingVars($thingId,$thingDataId);
if ($output){
return JSON->new->utf8->encode($output);
return JSON->new->encode($output);
}
else{
$session->http->setStatus("404", "Not Found");
return JSON->new->utf8->encode({message => "The thingDataId you requested can not be found."});
return JSON->new->encode({message => "The thingDataId you requested can not be found."});
}
}
else {
$session->http->setStatus("404", "Not Found");
return JSON->new->utf8->encode({message => "The thingId you requested can not be found."});
return JSON->new->encode({message => "The thingId you requested can not be found."});
}
}

View file

@ -4,7 +4,7 @@ use strict;
our $VERSION = "1.0.0";
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using

View file

@ -1,7 +1,7 @@
package WebGUI::Asset::Wobject::UserList;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using

View file

@ -3,7 +3,7 @@ package WebGUI::Asset::Wobject::WeatherData;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2008 Plain Black Corporation.
WebGUI is Copyright 2001-2009 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using

View file

@ -1,7 +1,7 @@
package WebGUI::Asset::Wobject::WikiMaster;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using

View file

@ -3,7 +3,7 @@ package WebGUI::Asset::Wobject::NewWobject;
$VERSION = "1.0.0";
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using