merge back with HEAD for 7.7.0

This commit is contained in:
Colin Kuskie 2009-03-05 16:19:12 +00:00
parent 426bc41b04
commit 04105713f0
23 changed files with 120 additions and 60 deletions

View file

@ -1,3 +1,6 @@
7.7.0
- fixed: Template parser cannot be set
7.6.14
- fixed: IE6 shows Admin Bar over Asset Manager
- fixed #9808: Search i18n

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -117,6 +117,8 @@ sub upgradeConfigFiles {
print "DONE!\n" unless $quiet;
}
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
#----------------------------------------------------------------------------

View file

@ -2,7 +2,7 @@ package WebGUI;
our $VERSION = '7.7.0';
our $STATUS = 'really dangerous';
our $STATUS = 'beta';
=head1 LEGAL

View file

@ -261,27 +261,32 @@ sub set {
$self->{_properties}{priority} = exists $properties->{priority} ? $properties->{priority} : $self->{_properties}{priority};
# prerender the ad for faster display
my $adSpace = WebGUI::AdSpace->new($self->session, $self->get("adSpaceId"));
if ($self->get("type") eq "text") {
$self->{_properties}{renderedAd} = '<div style="position:relative; width:' . ($adSpace->get("width")-2) . 'px; height:' .
($adSpace->get("height")-2) . 'px; margin:0px; overflow:hidden; border:solid ' . $self->get("borderColor") .
q{ 1px;"><a href='#' OnClick="window.location.assign('} .
$self->session->url->gateway(undef, "op=clickAd;id=".$self->getId) .
q{')" style="position:absolute; padding: 3px; top:0px; left:0px; width:100%; height:100%; z-index:10;} .
' display:block; text-decoration:none; vertical-align:top; background-color:' . $self->get("backgroundColor") .
'; font-size: 13px; font-weight: normal;"><b><span style="color:' . $self->get("textColor") . ';">' .
$self->get("title") . '</span></b><br /><span style="color:' . $self->get("textColor") . ';">' .
$self->get("adText") . '</span></a></div>';
} elsif ($self->get("type") eq "image") {
my $storage = WebGUI::Storage->get($self->session, $self->get("storageId"));
$self->{_properties}{renderedAd} = '<div style="position:relative; width:' . $adSpace->get("width") . 'px; height:' .
$adSpace->get("height") . 'px; margin:0px; overflow:hidden; border:0px;"><a href="#" ' .
q{onClick="window.location.assign('} .
$self->session->url->gateway(undef, "op=clickAd;id=".$self->getId) . q{')" style="position:absolute; padding: } .
'3px; top:0px; left:0px; width:100%; height:100%; z-index:10; display:block; text-decoration:none; ' .
'vertical-align:top;"><img ' .
'src="' . $storage->getUrl($storage->getFiles->[0]) . '" alt="' . $self->get("title") .
'" style="z-index:0;position:relative;border-style:none;border: 0px;" /></a></div>';
} elsif ($self->get("type") eq "rich") {
if ($self->get("type") eq "text") {
$self->{_properties}{renderedAd} =
q{<div style="position:relative; width:} . ($adSpace->get("width")-2) . q{px; height:}
. ($adSpace->get("height")-2) . q{px; margin:0px; overflow:hidden; border:solid }
. $self->get("borderColor") . q{ 1px;"><a href='#' onclick="window.location.assign('}
. $self->session->url->gateway(undef, "op=clickAd;id=".$self->getId)
. q{')" style="position:absolute; padding: 3px; top:0px; left:0px; width:100%; height:100%; z-index:10;}
. q{ display:block; text-decoration:none; vertical-align:top; background-color:}
. $self->get("backgroundColor") . q{; font-size: 13px; font-weight: normal;"><b><span style="color:}
. $self->get("textColor") . q{;">} . $self->get("title")
. q{</span></b><br /><span style="color:} . $self->get("textColor") . q{;">}
. $self->get("adText") . q{</span></a></div>};
}
elsif ($self->get("type") eq "image") {
my $storage = WebGUI::Storage->get($self->session, $self->get("storageId"));
$self->{_properties}{renderedAd} =
q{<div style="position:relative; width:} . $adSpace->get("width") . q{px; height:}
. $adSpace->get("height") . q{px; margin:0px; overflow:hidden; border:0px;"><a href="#" }
. q{onclick="window.location.assign('} .$self->session->url->gateway(undef, "op=clickAd;id=".$self->getId)
. q{')" style="position:absolute; padding: }
. q{3px; top:0px; left:0px; width:100%; height:100%; z-index:10; display:block; text-decoration:none; }
. q{vertical-align:top;"><img }
. q{src="} . $storage->getUrl($storage->getFiles->[0]) . q{" alt="} . $self->get("title")
. q{" style="z-index:0;position:relative;border-style:none;border: 0px;" /></a></div>};
}
elsif ($self->get("type") eq "rich") {
my $ad = $self->get("richMedia");
WebGUI::Macro::process($self->session, \$ad);
$self->{_properties}{renderedAd} = $ad;

View file

@ -313,6 +313,14 @@ sub getEditForm {
$attribute->{label} = $attribute->{name};
$attribute->{subtext} = $attribute->{description};
$attribute->{name} = 'attribute_'.$attribute->{attributeId};
if($attribute->{fieldType} eq 'Combo'){
my %options;
tie %options, 'Tie::IxHash';
%options = $db->buildHash("select value, value from MatrixListing_attribute
where attributeId = ? and value != '' order by value",[$attribute->{attributeId}]);
$attribute->{options} = \%options;
$attribute->{extras} = "style='width:120px'";
}
$form->dynamicField(%{$attribute});
}
}
@ -572,6 +580,8 @@ sub view {
if ($emailSent){
$var->{emailSent} = 1;
}
$var->{canEdit} = $self->canEdit;
$var->{editUrl} = $self->getUrl("func=edit");
$var->{controls} = $self->getToolbar;
$var->{comments} = $self->getFormattedComments();
$var->{productName} = $var->{title};

View file

@ -88,7 +88,7 @@ sub definition {
},
parser => {
noFormPost => 1,
fieldType => 'selectList',
fieldType => 'selectBox',
defaultValue => [$session->config->get("defaultTemplateParser")],
},
namespace => {
@ -144,6 +144,7 @@ sub processPropertiesFromFormPost {
my %data;
my $needsUpdate = 0;
if ($self->getValue("parser") ne $self->session->form->process("parser","className") && ($self->session->form->process("parser","className") ne "")) {
$needsUpdate = 1;
if (isIn($self->session->form->process("parser","className"),@{$self->session->config->get("templateParsers")})) {
%data = ( parser => $self->session->form->process("parser","className") );
} else {

View file

@ -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

@ -1019,6 +1019,7 @@ sub www_addFileService {
title => $form->get('title','text'),
description => $form->get('synopsis','textarea'),
synopsis => $form->get('synopsis','textarea'),
ownerUserId => $session->user->userId,
});
my $storage = $file->getStorageLocation;

View file

@ -442,6 +442,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 =>
@ -1024,6 +1026,7 @@ 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;
@ -1038,11 +1041,13 @@ 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'});
@ -1144,6 +1149,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'),
@ -1175,7 +1181,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};
@ -1184,10 +1190,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

@ -212,6 +212,7 @@ sub purgeRevision {
}
#-------------------------------------------------------------------
=head2 view ( )
method called by the container www_view method.
@ -261,6 +262,7 @@ our @EXPORT = qw(install uninstall);
use WebGUI::Session;
#-------------------------------------------------------------------
sub install {
my $config = $ARGV[0];
my $home = $ARGV[1] || "/data/WebGUI";
@ -279,6 +281,7 @@ sub install {
}
#-------------------------------------------------------------------
sub uninstall {
my $config = $ARGV[0];
my $home = $ARGV[1] || "/data/WebGUI";

View file

@ -120,6 +120,7 @@ sub acceptsPrivateMessages {
my $userId = shift;
return 0 if ($self->isVisitor); #Visitor can't get private messages
return 0 if ($userId eq "1"); # Visitor can't send private messages
return 0 if ($self->userId eq $userId); #Can't send private messages to yourself
my $pmSetting = $self->profileField('allowPrivateMessages');

View file

@ -161,10 +161,16 @@ our $I18N = { ##hashref of hashes
'no results' => {
message => q|No results were found.|,
content => q|An internationalized label for telling the user that no results were found.|,
context => q|An internationalized label for telling the user that no results were found.|,
lastUpdated => 1170549113,
},
'no_results' => {
message => q|An internationalized label for telling the user that no results were found.|,
context => q|Template variable in the view method.|,
lastUpdated => 1236101532,
},
};
1;

View file

@ -4,8 +4,8 @@ use strict;
our $I18N = {
'assetName' => {
message => q|Survey|,
lastUpdated => 1224686319
message => q|Survey (beta)|,
lastUpdated => 1236187015
},
'edit survey' => {
message => q|Edit Survey|,

View file

@ -47,6 +47,9 @@ SKIP: {
skip "Unable to load WebGUI::AdSpace", $numTests-1 unless $loaded;
local $ENV{REMOTE_ADDR} = '10.0.0.1';
local $ENV{HTTP_USER_AGENT} = 'Mozilla/5.0';
$adSpace = WebGUI::AdSpace->create($session, {name=>"Alfred"});
isa_ok($adSpace, 'WebGUI::AdSpace');

View file

@ -54,6 +54,10 @@ $imageStorage->addFileFromScalar('foo.bmp', 'This is not really an image');
SKIP: {
skip "Unable to load WebGUI::AdSpace::Ad", $numTests-1 unless $loaded;
local $ENV{REMOTE_ADDR} = '10.0.0.1';
local $ENV{HTTP_USER_AGENT} = 'Mozilla/5.0';
$adSpace = WebGUI::AdSpace->create($session, {name=>"Alfred"});
$ad=WebGUI::AdSpace::Ad->create($session, $adSpace->getId, {"type" => "text"});
isa_ok($ad,"WebGUI::AdSpace::Ad");
@ -115,11 +119,11 @@ SKIP: {
##Link checks
$token = $textP->get_tag("a");
my $href = $token->[1]{href};
my $href = $token->[1]{onclick};
like($href, qr/op=clickAd/, 'ad link has correct operation');
my $adId = $textAd->getId;
like($href, qr/id=$adId/, 'ad link has correct ad id');
like($href, qr/id=\Q$adId\E/, 'ad link has correct ad id');
$style = $token->[1]{style};
like($style, qr/background-color:white/, 'ad link background is white');
@ -159,11 +163,11 @@ SKIP: {
##Link checks
$token = $textP->get_tag("a");
my $href = $token->[1]{href};
my $href = $token->[1]{onclick};
like($href, qr/op=clickAd/, 'ad link has correct operation, image');
$adId = $imageAd->getId;
like($href, qr/id=$adId/, 'ad link has correct ad id, image');
like($href, qr/id=\Q$adId\E/, 'ad link has correct ad id, image');
$token = $textP->get_tag("img");
$style = $token->[1]{src};

View file

@ -1883,7 +1883,7 @@ cmp_deeply(
verbatim => $index == 4 ? 1 : 0,
recordedAnswer => $index++,
})
} 'Democratic party', 'Republican party (or GOP)', 'Independant party', 'Other party (verbatim)',
} 'Democratic party', 'Republican party (or GOP)', 'Independent party', 'Other party (verbatim)',
],
'updateQuestionAnswers: Party type'
);

View file

@ -31,7 +31,10 @@ my $categories = WebGUI::ProfileCategory->getCategories($session);
my @labels = map { $_->getLabel } @{ $categories };
$categories->[0]->set({ visible => 0});
my %originalProperties = %{ $categories->[0]->get };
my %properties = %originalProperties;
$properties{visible} = 0;
$categories->[0]->set(\%properties);
my $newCategories = WebGUI::ProfileCategory->getCategories($session);
my @newLabels = map { $_->getLabel } @{ $newCategories };
@ -39,4 +42,5 @@ my @newLabels = map { $_->getLabel } @{ $newCategories };
cmp_bag(\@newLabels, \@labels, 'Setting a category to not be visible does not change its availability through getCategories, with no options');
END {
$categories->[0]->set(\%originalProperties);
}

View file

@ -1,7 +1,7 @@
YAHOO.util.Event.addListener(window, "load", function() {
YAHOO.example.XHR_JSON = new function() {
this.formatUrl = function(elCell, oRecord, oColumn, sData) {
elCell.innerHTML = "<a href='" + oRecord.getData("url") + "' target='_blank'>" + sData + "</a>";
elCell.innerHTML = "<a href='" + oRecord.getData("url") + "'>" + sData + "</a>";
};
this.formatCheckBox = function(elCell, oRecord, oColumn, sData) {
var innerHTML = "<input type='checkbox' name='listingId' value='" + sData + "' id='" + sData + "_checkBox'";
@ -23,6 +23,7 @@ YAHOO.util.Event.addListener(window, "load", function() {
var uri = "func=getCompareFormData";
if(typeof(listingIds) != 'undefined'){
uri = uri + ';__listingId_isIn=1';
for (var i = 0; i < listingIds.length; i++) {
uri = uri+';listingId='+listingIds[i];
}
@ -33,7 +34,7 @@ YAHOO.util.Event.addListener(window, "load", function() {
this.myDataSource.connXhrMode = "queueRequests";
this.myDataSource.responseSchema = {
resultsList: "ResultSet.Result",
fields: ["title",{key: "views", parser: "number"},{key: "clicks", parser: "number"},{key: "compares", parser: "number"},{key: "checked", parser: "number"},{key: "lastUpdated", parser: "number"},"url","assetId"]
fields: ["title",{key: "views", parser: "number"},{key: "clicks", parser: "number"},{key: "compares", parser: "number"},{key: "checked"},{key: "lastUpdated", parser: "number"},"url","assetId"]
};
this.myDataTable = new YAHOO.widget.DataTable("compareForm", myColumnDefs,

View file

@ -71,8 +71,7 @@ YAHOO.util.Event.addListener(window, "load", function() {
}
this.myDataSource.doBeforeParseData = function (oRequest, oFullResponse) {
myDataTable.getRecordSet().reset();
myDataTable.refreshView();
this.responseSchema.fields = oFullResponse.ResponseFields;
var existingColumns = myDataTable.getColumnSet().keys;
for (var i = 0; i < existingColumns.length; i++) {
if(i > 1){
@ -114,6 +113,9 @@ YAHOO.util.Event.addListener(window, "load", function() {
uri = uri+';listingId='+compareCheckBoxes[i].value;
}
}
myDataTable.getRecordSet().reset();
myDataTable.refreshView();
myDataTable.showTableMessage('Loading...');
this.myDataSource.sendRequest(uri,callback2);
},this,true);
@ -126,6 +128,9 @@ YAHOO.util.Event.addListener(window, "load", function() {
uri = uri+';listingId='+compareCheckBoxes[i].value;
}
}
myDataTable.getRecordSet().reset();
myDataTable.refreshView();
myDataTable.showTableMessage('Loading...');
this.myDataSource.sendRequest(uri,callback2);
},this,true);

View file

@ -3,7 +3,7 @@ YAHOO.util.Event.addListener(window, "load", function() {
var Dom = YAHOO.util.Dom;
this.formatUrl = function(elCell, oRecord, oColumn, sData) {
elCell.innerHTML = "<a href='" + oRecord.getData("url") + "' target='_blank'>" + sData + "</a>";
elCell.innerHTML = "<a href='" + oRecord.getData("url") + "'>" + sData + "</a>";
};
this.formatCheckBox = function(elCell, oRecord, oColumn, sData) {
var innerHTML = "<input type='checkbox' name='listingId' value='" + sData + "' id='" + sData + "_checkBox'";