added YUI and YUI-ext

fixed the resizable text area with IE problem
fixed the ad space with IE problem
merged the 7.2.0 and 7.1.4 change logs
This commit is contained in:
JT Smith 2006-11-07 23:15:57 +00:00
parent 6bf329d68d
commit 4f68a0933c
1026 changed files with 331404 additions and 60 deletions

View file

@ -178,6 +178,25 @@ sub getAds {
#-------------------------------------------------------------------
=head2 getAdSpaces ( session )
Returns an array reference containing all the ad spaces. This is a class method.
=cut
sub getAdSpaces {
my $class = shift;
my $session = shift;
my @ads = ();
my $rs = $session->db->read("select adSpaceId from adSpace order by title");
while (my ($id) = $rs->array) {
push(@ads, WebGUI::AdSpace->new($session, $id));
}
return \@ads;
}
#-------------------------------------------------------------------
=head2 getId ( )
Returns the id of this object.

View file

@ -254,17 +254,10 @@ sub set {
# 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} = '<a href="'.$self->session->url->gateway(undef, "op=clickAd;id=".$self->getId)
.'" style="text-decoration: none;"><div style="overflow: hidden; font-size: 13px; font-weight: normal; width: '
.($adSpace->get("width") - 2)
.'px; padding: 3px; height: '.($adSpace->get("height") - 2).'px; color: '.$self->get("textColor")
.'; background-color: '.$self->get("backgroundColor")
.'; border: 1px solid '.$self->get("borderColor").';"><b>'
.$self->get("title").'</b><br />'.$self->get("adText").'</div></a>';
$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").' 1px;"><a href="'.$self->session->url->gateway(undef, "op=clickAd;id=".$self->getId).'" 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::Image->get($self->session, $self->get("storageId"));
$self->{_properties}{renderedAd} = '<a href="'.$self->session->url->gateway(undef, "op=clickAd;id=".$self->getId).'"><div style="overflow: hidden; width: '.$adSpace->get("width").'px; height: '.$adSpace->get("height").'px;"><img src="'.$storage->getUrl($storage->getFiles->[0]).'" style="border: 0px;" alt="'.$self->get("title").'" /></div></a>';
$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="'.$self->session->url->gateway(undef, "op=clickAd;id=".$self->getId).'" 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;" alt="'.$self->get("title").'" /></a></div>';
} elsif ($self->get("type") eq "rich") {
$self->{_properties}{renderedAd} = $self->get("richMedia");
}

View file

@ -516,13 +516,33 @@ sub www_edit {
$i18n->get("edit matrix"));
}
#-------------------------------------------------------------------
=head2 www_deleteImage ( )
Deletes and attached file.
=cut
sub www_deleteImage {
my $self = shift;
my $listing = $self->session->db->getRow("Matrix_listing","listingId",$self->session->form->process("listingId"));
my $i18n = WebGUI::International->new($self->session,'Asset_Matrix');
return $i18n->get('no edit rights') unless ($self->session->user->userId eq $listing->{maintainerId} || $self->canEdit);
if ($listing->{storageId} ne "") {
my $storage = WebGUI::Storage::Image->get($self->session, $listing->{storageId});
$storage->delete;
}
return $self->www_editListing($listing, $i18n);
}
#-------------------------------------------------------------------
sub www_editListing {
my $self = shift;
my $listing= $self->session->db->getRow("Matrix_listing","listingId",$self->session->form->process("listingId"));
my $i18n = WebGUI::International->new($self->session,'Asset_Matrix');
my $listing= shift || $self->session->db->getRow("Matrix_listing","listingId",$self->session->form->process("listingId"));
my $i18n = shift || WebGUI::International->new($self->session,'Asset_Matrix');
return $i18n->get('no edit rights') unless (($self->session->form->process("listingId") eq "new" && $self->session->user->isInGroup($self->get("groupToAdd"))) || $self->session->user->userId eq $listing->{maintainerId} || $self->canEdit);
my $f = WebGUI::HTMLForm->new($self->session,-action=>$self->getUrl);
$f->hidden(
@ -555,12 +575,10 @@ sub www_editListing {
$f->image(
name=>"screenshot",
label=>$i18n->get("screenshot"),
hoverHelp=>$i18n->get("screenshot help")
value=>$listing->{storageId},
hoverHelp=>$i18n->get("screenshot help"),
deleteFileUrl=>$self->getUrl("func=deleteImage;listingId=".$listing->{listingId}.";filename=")
);
if ($listing->{filename} && $listing->{storageId}) {
my $storage = WebGUI::Storage::Image->get($self->session, $listing->{storageId});
$f->readOnly(value=>'<img src="'.$storage->getThumbnailUrl($listing->{filename}).'" alt="'.$listing->{filename}.'" />');
}
$f->text(
-name=>"manufacturerName",
-value=>$listing->{manufacturerName},

View file

@ -106,17 +106,30 @@ Renders an input tag of type text.
sub toHtml {
my $self = shift;
my $resize = undef;
if ($self->get("resizeable")) {
my $i18n = WebGUI::International->new($self->session, "Form_Textarea");
$self->session->style->setScript($self->session->url->extras("resizeable_textarea.js"), {type=>"text/javascript"});
$resize = '<img src="'.$self->session->icon->getBaseURL().'/drag.gif" title="'.$i18n->get("drag to resize").'" alt="'.$i18n->get("drag to resize").'" class="draggable" onmousedown="tar_drag_start(event, \''.$self->get('id').'\');" />';
}
my $value = $self->fixMacros($self->fixTags($self->fixSpecialCharacters($self->get("value"))));
my $width = $self->get('width') || 400;
my $height = $self->get('height') || 150;
my $style = "width: ".$width."px; height: ".$height."px; ".$self->get("style");
return '<textarea id="'.$self->get('id').'" name="'.$self->get("name").'" style="'.$style.'" '.$self->get("extras").'>'.$value.'</textarea>'.$resize;
my $out = '<textarea id="'.$self->get('id').'" name="'.$self->get("name").'" style="'.$style.'" '.$self->get("extras").'>'.$value.'</textarea>';
if ($self->get("resizeable")) {
$out = '<div style="border: 0px;" class="yresizable-pinned" id="'.$self->get('id').'_wrapper">'.$out.'</div>';
my ($style, $url) = $self->session->quick(qw(style url));
$style->setScript($url->extras("yui/build/yahoo/yahoo.js"), {type=>"text/javascript"});
$style->setScript($url->extras("yui/build/event/event.js"), {type=>"text/javascript"});
$style->setScript($url->extras("yui/build/dom/dom.js"), {type=>"text/javascript"});
$style->setScript($url->extras("yui/build/dragdrop/dragdrop.js"), {type=>"text/javascript"});
$style->setScript($url->extras("yui/build/logger/logger.js"), {type=>"text/javascript"});
$style->setScript($url->extras("yui-ext/yui-ext-core.js"), {type=>"text/javascript"});
$style->setScript($url->extras("yui-ext/resizable-lib.js"), {type=>"text/javascript"});
$style->setLink($url->extras("yui-ext/resources/css/resizable.css"), {type=>"text/css", rel=>"stylesheet"});
$out .= qq|
<script type="text/javascript">
var draggable_textarea = document.getElementById('|.$self->get('id').qq|_wrapper');
draggable_textarea.resize = new YAHOO.ext.Resizable(draggable_textarea, {resizeChild: true, minWidth:300, minHeight:200, disableTrackOver:true, multiDirectional: false});
</script>
|;
}
return $out;
}

View file

@ -380,13 +380,12 @@ sub www_manageAdSpaces {
my $ac = WebGUI::AdminConsole->new($session,"adSpace");
my $i18n = WebGUI::International->new($session,"AdSpace");
my $output = "";
my $rs = $session->db->read("select adSpaceId, title from adSpace order by title");
while (my ($id, $title) = $rs->array) {
foreach my $adSpace (@{WebGUI::AdSpace->getAdSpaces($session)}) {
$output .= '<div style="float: left; margin: 10px;">'
.$session->icon->delete("op=deleteAdSpace;adSpaceId=".$id, undef, $i18n->get("confirm ad space delete"))
.$session->icon->edit("op=editAdSpace;adSpaceId=".$id)
.' '.$title.'<br />'
.WebGUI::AdSpace->new($session, $id)->displayImpression(1)
.$session->icon->delete("op=deleteAdSpace;adSpaceId=".$adSpace->getId, undef, $i18n->get("confirm ad space delete"))
.$session->icon->edit("op=editAdSpace;adSpaceId=".$adSpace->getId)
.' '.$adSpace->get("title").'<br />'
.$adSpace->displayImpression(1)
.'</div>';
}
$output .= '<div style="clear: both;"></div>';

View file

@ -78,11 +78,7 @@ Macros are processed in the tags if processed by this method.
sub generateAdditionalHeadTags {
my $self = shift;
# generate additional raw tags
my $tags = $self->{_raw};
# generate additional link tags
# generate additional javascript tags
$tags .= join '', values %{ $self->{_link} }, values %{ $self->{_javascript} };
delete $self->{_raw};
delete $self->{_javascript};
delete $self->{_link};
@ -287,12 +283,8 @@ sub setLink {
$tag .= ' '.$name.'="'.$params->{$name}.'"';
}
$tag .= ' />'."\n";
if ($self->sent) {
$self->session->output->print($tag);
}
else {
$self->{_link}{$url} = $tag;
}
$self->{_link}{$url} = 1;
$self->setRawHeadTags($tag);
}
#-------------------------------------------------------------------
@ -401,12 +393,8 @@ sub setScript {
$tag .= ' '.$name.'="'.$params->{$name}.'"';
}
$tag .= '></script>'."\n";
if ($self->sent) {
$self->session->output->print($tag);
}
else {
$self->{_javascript}{$url} = $tag;
}
$self->{_javascript}{$url} = 1;
$self->setRawHeadTags($tag);
}
#-------------------------------------------------------------------

View file

@ -1,12 +0,0 @@
package WebGUI::i18n::English::Form_Textarea; ##Be sure to change the package name to match the filename
our $I18N = { ##hashref of hashes
'drag to resize' => {
message => q|Drag to Resize|,
lastUpdated => 0,
context => q|alt tag for the text area drag icon|
},
};
1;