From 7b20b2db03b44a44951a8925a8ff891a5f259fd7 Mon Sep 17 00:00:00 2001 From: Matthew Wilson Date: Sun, 11 Sep 2005 17:36:39 +0000 Subject: [PATCH] - fix [ 1265771 ] assets that were formerly prototypes are... (mwilson) - fix [ 1280018 ] add new sql report - all query fields visible (mwilson) - fix [ 1283740 ] overridden in WebGUI/Mail.pm (mwilson) - fix [ 1282511 ] WebGUI::Form::submit disabled (mwilson) - fix [ 1281854 ] migration.txt - 5.6, 5.7 need some updating. (mwilson) - fix [ 1281842 ] rand() needs srand() on win32 mod_perl (mwilson) - fix [ 1281435 ] Asset::paste() or Asset::setParent() needs... (mwilson) - fix [ 1280374 ] Events calendar with no end date set loops... (mwilson) - fix [ 1230352 ] Navigation Template (mwilson) --- docs/changelog/6.x.x.txt | 17 +- docs/migration.txt | 10 +- lib/WebGUI/Asset.pm | 5 +- lib/WebGUI/Asset/Event.pm | 218 +------------- lib/WebGUI/Asset/Post/Thread.pm | 1 + lib/WebGUI/Asset/Wobject/EventsCalendar.pm | 312 ++++++++------------- lib/WebGUI/AssetClipboard.pm | 3 +- lib/WebGUI/AssetLineage.pm | 4 +- lib/WebGUI/HTMLForm.pm | 1 + lib/WebGUI/Macro/LastModified.pm | 3 +- lib/WebGUI/Mail.pm | 2 +- lib/WebGUI/Storage/Image.pm | 3 +- lib/WebGUI/i18n/English/Asset.pm | 6 +- 13 files changed, 159 insertions(+), 426 deletions(-) diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index c49ab1e7b..7607e3d78 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -32,7 +32,15 @@ - Fixed a bug where privileges were not being set correctly on cache files and that was causing write errors. - fix [ 1281437 ] hidden children appear when changing assetsToHide - + - fix [ 1265771 ] assets that were formerly prototypes are... (mwilson) + - fix [ 1280018 ] add new sql report - all query fields visible (mwilson) + - fix [ 1283740 ] overridden in WebGUI/Mail.pm (mwilson) + - fix [ 1282511 ] WebGUI::Form::submit disabled (mwilson) + - fix [ 1281854 ] migration.txt - 5.6, 5.7 need some updating. (mwilson) + - fix [ 1281842 ] rand() needs srand() on win32 mod_perl (mwilson) + - fix [ 1281435 ] Asset::paste() or Asset::setParent() needs... (mwilson) + - fix [ 1280374 ] Events calendar with no end date set loops... (mwilson) + - fix [ 1230352 ] Navigation Template (mwilson) 6.7.3 - User search now includes user alias. @@ -40,9 +48,7 @@ and karma were not showing up when editing users. - fix [ 1274239 ] Can Not Save Edits to Assets - fix [ 1274414 ] extraHeadTags entirely unused (mwilson) -<<<<<<< 6.x.x.txt - fix [ 1265709 ] 6.7.1 - most help topics appear twice -======= - fix [ 1276625 ] viewRSS not working (Andrew Khmelev) - fix [ 1276695 ] Addition to 'viewRSS not working' (6.7.2) (Andrew Khmelev) - Fixed a layout problem with the user search form. @@ -62,8 +68,6 @@ - fix [ 1279157 ] showInForms option not stored - fix [ 1250290 ] ECommerce state field broken on Plainblack.com - fix [ 1261985 ] (Fix?) sortby.lastreply.url (Andreas Graf) ->>>>>>> 1.474 - 6.7.2 - fix [ 1163407 ] Ampersand XHTML 1.0 Non-Compliant @@ -1495,5 +1499,4 @@ webgui. - Bugfix [ 822805 ] Emptying trash can cause fatal error (Thanks to Steve Simms.) - Changed the upgrade system to stop after an error so the sys admin can fix - the problem before continuing. - + the problem before continuing. \ No newline at end of file diff --git a/docs/migration.txt b/docs/migration.txt index 237668a12..17876249d 100644 --- a/docs/migration.txt +++ b/docs/migration.txt @@ -305,7 +305,7 @@ converted them from regular functions into methods. In 6.1 we completely rewrote the underlying template framework to add template caching. Any plug-ins that use WebGUI::Template, must be updated to reflect -the new API. +the new API. Template caching is currently disabled, however. 5.7 Internationalization and Help Change @@ -326,7 +326,7 @@ is still intact as well. See WebGUI::International for API changes. As a developer you can convert your translations (including English) and your help files using a script we provide. You can find the script here: -http://www.plainblack.com/translations?wid=1552&func=viewSubmission&sid=1213 +http://www.plainblack.com/translations/translations 5.8 WebGUI::Session Changes @@ -450,10 +450,14 @@ passing in an id parameter like this: $f->text(name=>"this",id==>"myownpersonalid"); +Also, calls to WebGUI::Form::submit must be changed to WebGUI::Form::Submit. +Also, WebGUI::Form::Submit by itself doesn't work. WebGUI::Form::Submit() +must be used. + See WebGUI::HTMLForm and WebGUI::Form::Control for additional information. -5.19 SQL Files For Upgrades Depricated +5.19 SQL Files For Upgrades Deprecated Starting with WebGUI 6.7.0 .sql files will no longer be used in core upgrades of WebGUI sites. We also suggest not using them for upgrades of custom code. diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index 278d9103f..2a5371627 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -406,8 +406,8 @@ sub getAssetAdderLinks { } my $sth = WebGUI::SQL->read("select asset.className,asset.assetId,max(assetData.revisionDate) from asset left join assetData on asset.assetId=assetData.assetId where assetData.isPrototype=1 and asset.state='published' and asset.className in ($constraint) group by assetData.assetId"); while (my ($class,$id,$date) = $sth->array) { - my $asset = WebGUI::Asset->new($id,$class,$date); - next unless ($asset->canView && $asset->canAdd && $asset->getUiLevel <= $session{user}{uiLevel}); + my $asset = WebGUI::Asset->new($id,$class); + next unless ($asset->get("isPrototype") eq '1' && $asset->canView && $asset->canAdd && $asset->getUiLevel <= $session{user}{uiLevel}); my $url = $self->getUrl("func=add;class=".$class.";prototype=".$id); $url = WebGUI::URL::append($url,$addToUrl) if ($addToUrl); $links{$asset->getTitle}{url} = $url; @@ -416,6 +416,7 @@ sub getAssetAdderLinks { $links{$asset->getTitle}{'isPrototype'} = 1; $links{$asset->getTitle}{'asset'} = $asset; } + $sth->finish; my @sortedLinks; foreach my $label (sort keys %links) { push(@sortedLinks,{ diff --git a/lib/WebGUI/Asset/Event.pm b/lib/WebGUI/Asset/Event.pm index fb2b921dd..395c1f963 100644 --- a/lib/WebGUI/Asset/Event.pm +++ b/lib/WebGUI/Asset/Event.pm @@ -14,25 +14,16 @@ use strict; use Tie::CPHash; use WebGUI::DateTime; use WebGUI::Form; -use WebGUI::Grouping; use WebGUI::HTML; use WebGUI::HTMLForm; -use WebGUI::HTTP; use WebGUI::Icon; use WebGUI::Id; use WebGUI::International; -use WebGUI::MessageLog; -use WebGUI::Operation; -use WebGUI::Paginator; use WebGUI::Privilege; use WebGUI::Session; use WebGUI::Style; -use WebGUI::Asset::Template; use WebGUI::URL; -use WebGUI::User; -use WebGUI::Utility; use WebGUI::Asset; -use WebGUI::Asset::Wobject::EventsCalendar; our @ISA = qw(WebGUI::Asset); @@ -50,119 +41,36 @@ sub definition { description => { fieldType=>"HTMLArea", defaultValue=>undef - }, + }, eventStartDate => { fieldType=>"dateTime", defaultValue=>time() - }, + }, eventEndDate => { fieldType=>"dateTime", defaultValue=>time() - }, + }, EventsCalendar_recurringId => { fieldType=>"hidden", defaultValue=>undef - }, + }, eventLocation => { fieldType=>"text", defaultValue=>undef - }, -# allowRegistration => { -# fieldType=>"yesNo", -# defaultValue=>0 -# }, -# allowUnregistration => { -# fieldType=>"yesNo", -# defaultValue=>0 -# }, -# regConfirm => { -# fieldType=>"yesNo", -# defaultValue=>0 -# }, -# regNotify => { -# fieldType=>"yesNo", -# defaultValue=>0 -# }, -# regStartDate => { -# fieldType=>"dateTime", -# defaultValue=>time() -# }, -# regEndDate => { -# fieldType=>"dateTime", -# defaultValue=>time() -# }, -# allowReminders => { -# fieldType=>"yesNo", -# defaultValue=>0 -# }, -# reminderStartDate => { -# fieldType=>"dateTime", -# defaultValue=>time() -# }, -# reminderEndDate => { -# fieldType=>"dateTime", -# defaultValue=>time() -# }, -# reminderRecurs => { -# fieldType=>"interval", -# defaultValue=>604800 -# }, -# chargeForEvent => { -# fieldType=>"yesNo", -# defaultValue=>0 -# }, -# firstAttendeeFee => { -# fieldType=>"float", -# defaultValue=>0 -# }, -# secondAttendeeFee => { -# fieldType=>"float", -# defaultValue=>0 -# }, -# availableSeats => { -# fieldType=>"integer", -# defaultValue=>0 -# }, + }, templateId => { fieldType=>"template", defaultValue=>'PBtmpl0000000000000023' - }, -# regConfirmTemplateId => { -# fieldType=>"template", -# defaultValue=>'MWtmplregConfirm000001' -# }, -# regNotifyTemplateId => { -# fieldType=>"template", -# defaultValue=>'MWtmplregNotify0000001' -# }, -# reminderTemplateId => { -# fieldType=>"template", -# defaultValue=>'MWtmplreminder00000001' -# }, -# groupCanRegister => { -# fieldType=>"group", -# defaultValue=>'2' -# }, -# groupCanReminder => { -# fieldType=>"group", -# defaultValue=>'2' -# }, -# groupRegNotify => { -# fieldType=>"group", -# defaultValue=>'3' -# } + } } }); return $class->SUPER::definition($definition); } - - #------------------------------------------------------------------- sub getEditForm { my $self = shift; my $tabform = $self->SUPER::getEditForm(); - #return $tabform; $tabform->getTab("properties")->HTMLArea( -name=>"description", -label=>WebGUI::International::get(512,"Asset_Event"), @@ -189,70 +97,7 @@ sub getEditForm { -hoverHelp=>WebGUI::International::get('515 description',"Asset_Event"), -value=>$self->getValue("eventLocation") ); -# $tabform->getTab("properties")->yesNo( -# -name=>"allowRegistration", -# -label=>WebGUI::International::get(516,"Asset_Event"), -# -value=>$self->getValue("allowRegistration") -# ); -# $tabform->getTab("properties")->yesNo( -# -name=>"allowUnregistration", -label=>WebGUI::International::get(517,"Asset_Event"), -# -value=>$self->getValue("allowUnregistration") -# ); -# $tabform->getTab("properties")->yesNo( -# -name=>"regConfirm", -label=>WebGUI::International::get(518,"Asset_Event"), -# -value=>$self->getValue("regConfirm") -# ); -# $tabform->getTab("properties")->yesNo( -# -name=>"regNotify", -label=>WebGUI::International::get(519,"Asset_Event"), -# -value=>$self->getValue("regNotify") -# ); -# $tabform->getTab("properties")->dateTime( -# -name=>"regStartDate", -label=>WebGUI::International::get(520,"Asset_Event"), -# -extras=>'onBlur="this.form.regEndDate.value=this.form.regStartDate.value;this.form.until.value=this.form.regStartDate.value;"', -# -value=>$self->getValue("regStartDate") -# ); -# $tabform->getTab("properties")->dateTime( -# -name=>"regEndDate", -label=>WebGUI::International::get(521,"Asset_Event"), -# -extras=>'onBlur="this.form.until.value=this.form.regEndDate.value;"', -# -value=>$self->getValue("regEndDate") -# ); -# $tabform->getTab("properties")->yesNo( -# -name=>"allowReminders", -label=>WebGUI::International::get(522,"Asset_Event"), -# -value=>$self->getValue("allowReminders") -# ); -# $tabform->getTab("properties")->dateTime( -# -name=>"reminderStartDate", -label=>WebGUI::International::get(523,"Asset_Event"), -# -extras=>'onBlur="this.form.reminderEndDate.value=this.form.reminderStartDate.value;this.form.until.value=this.form.reminderStartDate.value;"', -# -value=>$self->getValue("reminderStartDate") -# ); -# $tabform->getTab("properties")->dateTime( -# -name=>"reminderEndDate", -label=>WebGUI::International::get(524,"Asset_Event"), -# -extras=>'onBlur="this.form.until.value=this.form.reminderEndDate.value;"', -# -value=>$self->getValue("regEndDate") -# ); -# $tabform->getTab("properties")->interval( -# -name=>"reminderRecurs", -# -label=>WebGUI::International::get(524.5,"Asset_Event"), -# -value=>$self->getValue("reminderRecurs") -# ); -# Not quite implemented yet... -# $tabform->getTab("properties")->yesNo( -# -name=>"chargeForEvent", -label=>WebGUI::International::get(525,"Asset_Event"), -# -value=>$self->getValue("chargeForEvent") -# ); -# $tabform->getTab("properties")->float( -# -name=>"firstAttendeeFee", -label=>WebGUI::International::get(526,"Asset_Event"), -# -value=>$self->getValue("firstAttendeeFee") -# ); -# $tabform->getTab("properties")->float( -# -name=>"secondAttendeeFee", -label=>WebGUI::International::get(527,"Asset_Event"), -# -value=>$self->getValue("secondAttendeeFee") -# ); -# $tabform->getTab("properties")->integer( -# -name=>"availableSeats", -label=>WebGUI::International::get(528,"Asset_Event"), -# -value=>$self->getValue("availableSeats") -# ); - if (($session{form}{func} eq "addStyledEvent") || ($session{form}{func} eq "add") || ($session{form}{func} eq "addEvent")) { + if ($session{form}{func} eq "add") { my %recursEvery; tie %recursEvery, 'Tie::IxHash'; %recursEvery = ( @@ -279,13 +124,6 @@ sub getEditForm { }) ); } -# $tabform->getTab("display")->template( -# -name=>"confirmationTemplateId", -# -value=>$self->getValue("confirmationTemplateId"), -# -namespace=>"EventsCalendar/Event", -# -label=>WebGUI::International::get(529,"Asset_Event"), -# -afterEdit=>'func=edit' -# ); $tabform->getTab("display")->template( -name=>"templateId", -value=>$self->getValue("templateId"), @@ -293,30 +131,6 @@ sub getEditForm { -label=>WebGUI::International::get(530,"Asset_Event"), -hoverHelp=>WebGUI::International::get('530 description',"Asset_Event"), ); -# $tabform->getTab("display")->template( -# -name=>"regNotifyTemplateId", -# -value=>$self->getValue("regNotifyTemplateId"), -# -namespace=>"EventsCalendar/Event", -# -label=>WebGUI::International::get(531,"Asset_Event"), -# ); -# $tabform->getTab("display")->template( -# -name=>"reminderTemplateId", -# -value=>$self->getValue("reminderTemplateId"), -# -namespace=>"EventsCalendar/Event", -# -label=>WebGUI::International::get(532,"Asset_Event"), -# ); -# $tabform->getTab("security")->group( -# -name=>"groupCanRegister", -label=>WebGUI::International::get(533,"Asset_Event"), -# -value=>[$self->getValue("groupCanRegister")] -# ); -# $tabform->getTab("security")->group( -# -name=>"groupCanReminder", -label=>WebGUI::International::get(534,"Asset_Event"), -# -value=>[$self->getValue("groupCanReminder")] -# ); -# $tabform->getTab("security")->group( -# -name=>"groupNotify", -label=>WebGUI::International::get(535,"Asset_Event"), -# -value=>[$self->getValue("regNotifyGroupId")] -# ); return $tabform; } @@ -329,7 +143,7 @@ sub processPropertiesFromFormPost { $self->SUPER::processPropertiesFromFormPost; if ($session{form}{assetId} eq "new") { $self->update({eventEndDate=>$self->get("eventStartDate")}) unless ($self->get("eventEndDate") >= $self->get("eventStartDate")); - if ($session{form}{recursEvery} ne "never") { + if ($session{form}{recursEvery} && $session{form}{recursEvery} ne "never") { my $until = WebGUI::DateTime::setToEpoch($session{form}{until}); $until = $self->get("eventEndDate") unless ($until >= $self->get("eventEndDate")); my $interval = ($session{form}{interval} < 1) ? 1 : $session{form}{interval}; @@ -402,10 +216,9 @@ sub view { $var{"edit.label"} = WebGUI::International::get(575,"Asset_Event"); $var{"delete.url"} = WebGUI::URL::page('func=deleteEvent;rid='.$self->getValue("EventsCalendar_recurringId")); $var{"delete.label"} = WebGUI::International::get(576,"Asset_Event"); - my $vars = \%var; #get parent so we can get the parent's style. Hopefully the parent is an EventsCalendar. If not, oh well. my $parent = $self->getParent; - return WebGUI::Style::process($self->processTemplate($vars,$self->getValue("templateId")),$parent->getValue("styleTemplateId")); + return WebGUI::Style::process($self->processTemplate(\%var,$self->getValue("templateId")),$parent->getValue("styleTemplateId")); } @@ -421,7 +234,7 @@ sub www_deleteEvent { .WebGUI::International::get(77,"Asset_Event").'

' if (($session{form}{rid} ne "") and ($session{form}{rid} ne "0")); $output .= ''.WebGUI::International::get(78,"Asset_Event").''; $output .= ''; - return return WebGUI::Style::process($output,$self->getParent->getValue("styleTemplateId")); + return WebGUI::Style::process($output,$self->getParent->getValue("styleTemplateId")); } @@ -452,16 +265,5 @@ sub www_edit { } - - -#------------------------------------------------------------------- -#sub www_editStyled { -# my $self = shift; -# #get parent so we can get the parent's style. Hopefully the parent is a wobject. If not, oh well. -# my $parent = WebGUI::Asset->newByDynamicClass($self->get("parentId")); -# return WebGUI::Privilege::noAccess() unless (($parent->getValue("className") eq "WebGUI::Asset::Wobject::EventsCalendar") && #($parent->canEdit)); -# return WebGUI::Style::process($self->getEditForm->print,$parent->getValue("styleTemplateId")); -#} - 1; diff --git a/lib/WebGUI/Asset/Post/Thread.pm b/lib/WebGUI/Asset/Post/Thread.pm index 8fee2a9de..4619cedb7 100644 --- a/lib/WebGUI/Asset/Post/Thread.pm +++ b/lib/WebGUI/Asset/Post/Thread.pm @@ -672,6 +672,7 @@ sub view { $currentPageUrl =~ s/^\///; $p->setDataByQuery($sql, undef, undef, undef, "url", $currentPageUrl); foreach my $dataSet (@{$p->getPageData()}) { + next unless ($dataSet->{className} eq "WebGUI::Asset::Post" || $dataSet->{className} eq "WebGUI::Asset::Post::Thread"); #handle non posts! my $reply = WebGUI::Asset::Post->new($dataSet->{assetId}, $dataSet->{className}, $dataSet->{revisionDate}); $reply->{_thread} = $self; # caching thread for better performance my %replyVars = %{$reply->getTemplateVars}; diff --git a/lib/WebGUI/Asset/Wobject/EventsCalendar.pm b/lib/WebGUI/Asset/Wobject/EventsCalendar.pm index 22d5fc482..40dd03320 100644 --- a/lib/WebGUI/Asset/Wobject/EventsCalendar.pm +++ b/lib/WebGUI/Asset/Wobject/EventsCalendar.pm @@ -62,14 +62,6 @@ sub definition { fieldType=>"selectList", defaultValue=>'0' }, - # type =>{ - # fieldType=>"selectList", - # defaultValue=>'0' - # }, - # groupIdManage =>{ - # fieldType=>"group", - # defaultValue=>'4' - # }, startMonth=>{ fieldType=>"selectList", defaultValue=>"current" @@ -98,88 +90,70 @@ sub definition { sub getEditForm { my $self = shift; my $tabform = $self->SUPER::getEditForm(); - # $tabform->getTab("properties")->selectList( - # -name=>"type", - # -label=>WebGUI::International::get(501,"Asset_EventsCalendar"), - # -value=>[$self->getValue("type")], - # -options=>{ - # 0=>WebGUI::International::get(502,"Asset_EventsCalendar"), - # 1=>WebGUI::International::get(503,"Asset_EventsCalendar"), - # 2=>WebGUI::International::get(504,"Asset_EventsCalendar"), - # 3=>WebGUI::International::get(505,"Asset_EventsCalendar"), - # 4=>WebGUI::International::get(506,"Asset_EventsCalendar") - # }, - # ); - $tabform->getTab("properties")->selectList( - -name=>"scope", - -label=>WebGUI::International::get(507,"Asset_EventsCalendar"), - -value=>[$self->getValue("scope")], - -options=>{ - 0=>WebGUI::International::get(508,"Asset_EventsCalendar"), - 1=>WebGUI::International::get(510,"Asset_EventsCalendar"), - 2=>WebGUI::International::get(509,"Asset_EventsCalendar"), - } - ); - $tabform->getTab("display")->template( - -name=>"templateId", - -label=>WebGUI::International::get(94,"Asset_EventsCalendar"), - -value=>$self->getValue('templateId'), - -namespace=>"EventsCalendar" - ); - $tabform->getTab("display")->template( - -name=>"eventTemplateId", - -label=>WebGUI::International::get(80,"Asset_EventsCalendar"), - -value=>$self->getValue('eventTemplateId'), - -namespace=>"EventsCalendar/Event", - ); - $tabform->getTab("display")->selectList( - -name=>"startMonth", - -options=>{ - "january"=>WebGUI::International::get('january','Asset_EventsCalendar'), - "now"=>WebGUI::International::get(98,"Asset_EventsCalendar"), - "current"=>WebGUI::International::get(82,"Asset_EventsCalendar"), - "first"=>WebGUI::International::get(83,"Asset_EventsCalendar") - }, - -label=>WebGUI::International::get(81,"Asset_EventsCalendar"), - -value=>[$self->getValue("startMonth")] - ); - my %options; - tie %options, 'Tie::IxHash'; - %options = ( + $tabform->getTab("properties")->selectList( + -name=>"scope", + -label=>WebGUI::International::get(507,"Asset_EventsCalendar"), + -value=>[$self->getValue("scope")], + -options=>{ + 0=>WebGUI::International::get(508,"Asset_EventsCalendar"), + 1=>WebGUI::International::get(510,"Asset_EventsCalendar"), + 2=>WebGUI::International::get(509,"Asset_EventsCalendar"), + } + ); + $tabform->getTab("display")->template( + -name=>"templateId", + -label=>WebGUI::International::get(94,"Asset_EventsCalendar"), + -value=>$self->getValue('templateId'), + -namespace=>"EventsCalendar" + ); + $tabform->getTab("display")->template( + -name=>"eventTemplateId", + -label=>WebGUI::International::get(80,"Asset_EventsCalendar"), + -value=>$self->getValue('eventTemplateId'), + -namespace=>"EventsCalendar/Event", + ); + $tabform->getTab("display")->selectList( + -name=>"startMonth", + -options=>{ + "january"=>WebGUI::International::get('january','Asset_EventsCalendar'), + "now"=>WebGUI::International::get(98,"Asset_EventsCalendar"), + "current"=>WebGUI::International::get(82,"Asset_EventsCalendar"), + "first"=>WebGUI::International::get(83,"Asset_EventsCalendar") + }, + -label=>WebGUI::International::get(81,"Asset_EventsCalendar"), + -value=>[$self->getValue("startMonth")] + ); + my %options; + tie %options, 'Tie::IxHash'; + %options = ( + "last"=>WebGUI::International::get(85,"Asset_EventsCalendar"), + "after12"=>WebGUI::International::get(86,"Asset_EventsCalendar"), + "after9"=>WebGUI::International::get(87,"Asset_EventsCalendar"), + "after6"=>WebGUI::International::get(88,"Asset_EventsCalendar"), + "after3"=>WebGUI::International::get(89,"Asset_EventsCalendar"), + "current"=>WebGUI::International::get(82,"Asset_EventsCalendar") + ); + $tabform->getTab("display")->selectList( + -name=>"endMonth", + -options=>\%options, + -label=>WebGUI::International::get(84,"Asset_EventsCalendar"), + -value=>[$self->getValue("endMonth")] + ); + $tabform->getTab("display")->selectList( + -name=>"defaultMonth", + -options=>{ + "current"=>WebGUI::International::get(82,"Asset_EventsCalendar"), "last"=>WebGUI::International::get(85,"Asset_EventsCalendar"), - "after12"=>WebGUI::International::get(86,"Asset_EventsCalendar"), - "after9"=>WebGUI::International::get(87,"Asset_EventsCalendar"), - "after6"=>WebGUI::International::get(88,"Asset_EventsCalendar"), - "after3"=>WebGUI::International::get(89,"Asset_EventsCalendar"), - "current"=>WebGUI::International::get(82,"Asset_EventsCalendar") - ); - $tabform->getTab("display")->selectList( - -name=>"endMonth", - -options=>\%options, - -label=>WebGUI::International::get(84,"Asset_EventsCalendar"), - -value=>[$self->getValue("endMonth")] - ); - $tabform->getTab("display")->selectList( - -name=>"defaultMonth", - -options=>{ - "current"=>WebGUI::International::get(82,"Asset_EventsCalendar"), - "last"=>WebGUI::International::get(85,"Asset_EventsCalendar"), - "first"=>WebGUI::International::get(83,"Asset_EventsCalendar") - }, - -label=>WebGUI::International::get(90,"Asset_EventsCalendar"), - -value=>[$self->getValue("defaultMonth")] - ); - $tabform->getTab("display")->integer( - -name=>"paginateAfter", - -label=>WebGUI::International::get(19,"Asset_EventsCalendar"), - -value=>$self->getValue("paginateAfter") - ); - # $tabform->getTab("security")->group( - # -name=>"groupIdManage", - # -label=>WebGUI::International::get(500,"Asset_EventsCalendar"), - # -value=>[$self->getValue("groupIdManage")], - # -uiLevel=>6 - # ); + "first"=>WebGUI::International::get(83,"Asset_EventsCalendar") + }, + -label=>WebGUI::International::get(90,"Asset_EventsCalendar"), + -value=>[$self->getValue("defaultMonth")] + ); + $tabform->getTab("display")->integer( + -name=>"paginateAfter", + -label=>WebGUI::International::get(19,"Asset_EventsCalendar"), + -value=>$self->getValue("paginateAfter") + ); return $tabform; } @@ -187,14 +161,6 @@ sub getEditForm { #------------------------------------------------------------------- sub view { - - # All of this really needs to be redone like the old - # EventsCalendar... except this time using getLineage to - # filter instead of doing all sorts of pruning. Also, caching - # needs to be re-enabled. Also, see the note below at line - # 407 - each dayloop event array needs to be sorted by startTime. - - my $self = shift; #define default view month range. Note that this could be different from #the range a user is allowed to view - set by the events calendar limitations. @@ -215,25 +181,18 @@ sub view { my ( $junk, $sameDate, $p, @list, $date, $flag, %previous, $maxDate, $minDate); my $monthloop; - - #had to disable caching because each event can have its own security. - # It can be re-added, of course. - my $scope = $self->getValue("scope"); my $children; - # get All My Children. if ($scope == 0) { #calendar's scope is regular (immediate descendants) $children = $self->getLineage(["children"],{returnObjects=>1, - includeOnlyClasses=>["WebGUI::Asset::Event","WebGUI::Asset::Relation"]}); + includeOnlyClasses=>["WebGUI::Asset::Event"]}); } elsif ($scope == 2) { #calendar is master $children = $self->getLineage(["descendants"],{returnObjects=>1, - includeOnlyClasses=>["WebGUI::Asset::Event","WebGUI::Asset::Relation"]}); + includeOnlyClasses=>["WebGUI::Asset::Event"]}); } elsif ($scope == 1) { #calendar is global $children = WebGUI::Asset::getRoot()->getLineage(["descendants"],{returnObjects=>1, - includeOnlyClasses=>["WebGUI::Asset::Event","WebGUI::Asset::Relation"]}); + includeOnlyClasses=>["WebGUI::Asset::Event"]}); } - # get Type of Calendar -# my $calType = $self->getValue("type"); my $startMonth = $self->getValue("startMonth"); #define range of allowed months from the wobject settings. @@ -299,8 +258,6 @@ sub view { next if (($eventEndDate < $minDate) && $startsNow); #Hide this event unless we are allowed to see it. Funny that each event has 4 date/time pairs. next unless $event->canView; - # only display events for this person's Personal Calendar, if it's so set. - # next unless (($calType != 1) || ($event->isMyEvent())); my $eventLength = WebGUI::DateTime::getDaysInInterval($eventStartDate,$eventEndDate); my ($startYear, $startMonth, $startDay, $startDate, $startTime, $startAmPm, $startDayOfWeek) = split " ", WebGUI::DateTime::epochToHuman($eventStartDate, "%y %c %D %z %Z %w"); @@ -359,68 +316,65 @@ sub view { $previous{start} = $startYear."-".$startMonth."-".$startDay; $previous{end} = $endYear."-".$endMonth."-".$endDay; -# } elsif (ref $event eq "WebGUI::Asset::Relation") { -# print "\n"; } } - if (($startsNow || ($startMonth eq "first")) && ($calHasEvent == 0)) { + # if (($startsNow || ($startMonth eq "first")) && ($calHasEvent == 0)) { #Let's process an extra month if this month had no events, #and if we're at the beginning of the calendar, and if #the calendar is supposed to start with the first event or now. - $calMonthEnd++ unless $monthHasEvent; - next unless $monthHasEvent; + # $calMonthEnd++ unless $monthHasEvent; + # next unless $monthHasEvent; + # } + my $dayOfWeekCounter = 1; + my $firstDayInFirstWeek = WebGUI::DateTime::getFirstDayInMonthPosition($thisMonth); + my $daysInMonth = WebGUI::DateTime::getDaysInMonth($thisMonth); + my @prepad; + while ($dayOfWeekCounter < $firstDayInFirstWeek) { + push(@prepad,{ + count => $dayOfWeekCounter + }); + $dayOfWeekCounter++; } - my $dayOfWeekCounter = 1; - my $firstDayInFirstWeek = WebGUI::DateTime::getFirstDayInMonthPosition($thisMonth); - my $daysInMonth = WebGUI::DateTime::getDaysInMonth($thisMonth); - my @prepad; - while ($dayOfWeekCounter < $firstDayInFirstWeek) { - push(@prepad,{ - count => $dayOfWeekCounter - }); - $dayOfWeekCounter++; + my @date = WebGUI::DateTime::epochToArray($thisMonth); + my @dayloop; + for (my $dayCounter=1; $dayCounter <= $daysInMonth; $dayCounter++) { + #---------------------------------------------------------------------------- + #sort each day's events here - still needs to be done! + #---------------------------------------------------------------------------- + push(@dayloop, { + dayOfWeek => $dayOfWeekCounter, + day=>$dayCounter, + isStartOfWeek=>($dayOfWeekCounter==1), + isEndOfWeek=>($dayOfWeekCounter==7), + isToday=>($date[0]."-".$date[1]."-".$dayCounter eq $now[0]."-".$now[1]."-".$now[2]), + event_loop=>\@{$events{$dayCounter}}, + url=>$events{$dayCounter}->[0]->{url} + }); + if ($dayOfWeekCounter == 7) { + $dayOfWeekCounter = 1; + } else { + $dayOfWeekCounter++; } - my @date = WebGUI::DateTime::epochToArray($thisMonth); - my @dayloop; - for (my $dayCounter=1; $dayCounter <= $daysInMonth; $dayCounter++) { - #---------------------------------------------------------------------------- - #sort each day's events here - still needs to be done! - #---------------------------------------------------------------------------- - push(@dayloop, { - dayOfWeek => $dayOfWeekCounter, - day=>$dayCounter, - isStartOfWeek=>($dayOfWeekCounter==1), - isEndOfWeek=>($dayOfWeekCounter==7), - isToday=>($date[0]."-".$date[1]."-".$dayCounter eq $now[0]."-".$now[1]."-".$now[2]), - event_loop=>\@{$events{$dayCounter}}, - url=>$events{$dayCounter}->[0]->{url} - }); - if ($dayOfWeekCounter == 7) { - $dayOfWeekCounter = 1; - } else { - $dayOfWeekCounter++; - } - } - my @postpad; - while ($dayOfWeekCounter <= 7 && $dayOfWeekCounter > 1) { - push(@postpad,{ - count => $dayOfWeekCounter - }); - $dayOfWeekCounter++; - } - push(@$monthloop, { - 'daysInMonth'=>$daysInMonth, - 'day_loop'=>\@dayloop, - 'prepad_loop'=>\@prepad, - 'postpad_loop'=>\@postpad, - 'month'=>WebGUI::DateTime::getMonthName($date[1]), - 'year'=>$date[0] - }); + } + my @postpad; + while ($dayOfWeekCounter <= 7 && $dayOfWeekCounter > 1) { + push(@postpad,{ + count => $dayOfWeekCounter + }); + $dayOfWeekCounter++; + } + push(@$monthloop, { + 'daysInMonth'=>$daysInMonth, + 'day_loop'=>\@dayloop, + 'prepad_loop'=>\@prepad, + 'postpad_loop'=>\@postpad, + 'month'=>WebGUI::DateTime::getMonthName($date[1]), + 'year'=>$date[0] + }); } my %var; $var{month_loop} = \@$monthloop; -# $var{"canManage"} = $self->canManage; - $var{"addevent.url"} = $self->getUrl().'?func=addStyledEvent;class=WebGUI::Asset::Event'; + $var{"addevent.url"} = $self->getUrl().'?func=add;class=WebGUI::Asset::Event'; $var{"addevent.label"} = WebGUI::International::get(20,"Asset_EventsCalendar"); $var{'sunday.label'} = WebGUI::DateTime::getDayName(7); $var{'monday.label'} = WebGUI::DateTime::getDayName(1); @@ -473,42 +427,6 @@ sub view { } - -#------------------------------------------------------------------- - -=head2 www_addStyledEvent ( ) - -Adds an event. - -=cut - -sub www_addStyledEvent { - my $self = shift; - my %properties = ( - groupIdView => $self->get("groupIdView"), - groupIdEdit => $self->get("groupIdEdit"), - ownerUserId => $self->get("ownerUserId"), - encryptPage => $self->get("encryptPage"), - templateId => $self->get("eventTemplateId"), - styleTemplateId => $self->get("styleTemplateId"), - printableStyleTemplateId => $self->get("printableStyleTemplateId"), - isHidden => $self->get("isHidden"), - startDate => $self->get("startDate"), - endDate => $self->get("endDate"), - assetId=> "new", - className=>"WebGUI::Asset::Event" - ); - $properties{isHidden} = 1 unless (WebGUI::Utility::isIn(ref $session{form}{class}, @{$session{config}{assetContainers}})); - my $newAsset = WebGUI::Asset->newByPropertyHashRef(\%properties); - $newAsset->{_parent} = $self; - #get parent so we can get the parent's style. Hopefully the parent is an EventsCalendar. If not, oh well. -# return "You must add an Event as a child of an EventsCalendar." unless ($self->getValue("className") = "WebGUI::Asset::Wobject::EventsCalendar"); - return WebGUI::Privilege::noAccess() unless ($self->canEdit); - return WebGUI::Style::process($newAsset->getEditForm->print,$self->getValue("styleTemplateId")); -} - - - #------------------------------------------------------------------- sub www_edit { my $self = shift; diff --git a/lib/WebGUI/AssetClipboard.pm b/lib/WebGUI/AssetClipboard.pm index 0f9eec36c..1c02a970d 100644 --- a/lib/WebGUI/AssetClipboard.pm +++ b/lib/WebGUI/AssetClipboard.pm @@ -150,7 +150,8 @@ Alphanumeric ID tag of Asset. sub paste { my $self = shift; my $assetId = shift; - my $pastedAsset = WebGUI::Asset->newByDynamicClass($assetId); + my $pastedAsset = WebGUI::Asset->newByDynamicClass($assetId); +return 0 unless ($self->get("state") eq "published"); if ($self->getId eq $pastedAsset->get("parentId") || $pastedAsset->setParent($self)) { $pastedAsset->publish; $pastedAsset->updateHistory("pasted to parent ".$self->getId); diff --git a/lib/WebGUI/AssetLineage.pm b/lib/WebGUI/AssetLineage.pm index 185cdb01e..d149a3daf 100644 --- a/lib/WebGUI/AssetLineage.pm +++ b/lib/WebGUI/AssetLineage.pm @@ -248,7 +248,7 @@ Returns the highest rank, top of the highest rank Asset under current Asset. sub getFirstChild { my $self = shift; unless (exists $self->{_firstChild}) { - my ($lineage) = WebGUI::SQL->quickArray("select min(lineage) from asset where parentId=".quote($self->getId)); + my ($lineage) = WebGUI::SQL->quickArray("select min(asset.lineage) from asset,assetData where asset.parentId=".quote($self->getId)." and asset.assetId=assetData.assetId and asset.state='published'"); $self->{_firstChild} = WebGUI::Asset->newByLineage($lineage); } return $self->{_firstChild}; @@ -266,7 +266,7 @@ Returns the lowest rank, bottom of the lowest rank Asset under current Asset. sub getLastChild { my $self = shift; unless (exists $self->{_lastChild}) { - my ($lineage) = WebGUI::SQL->quickArray("select max(lineage) from asset where parentId=".quote($self->getId)); + my ($lineage) = WebGUI::SQL->quickArray("select max(asset.lineage) from asset,assetData where asset.parentId=".quote($self->getId)." and asset.assetId=assetData.assetId and asset.state='published'"); $self->{_lastChild} = WebGUI::Asset->newByLineage($lineage); } return $self->{_lastChild}; diff --git a/lib/WebGUI/HTMLForm.pm b/lib/WebGUI/HTMLForm.pm index b04ffdd1e..d01e81a6d 100644 --- a/lib/WebGUI/HTMLForm.pm +++ b/lib/WebGUI/HTMLForm.pm @@ -86,6 +86,7 @@ sub AUTOLOAD { my $name = ucfirst((split /::/, $AUTOLOAD)[-1]); my %params = @_; $params{uiLevelOverride} ||= $self->{_uiLevelOverride}; + $params{rowClass} = $self->{_class}; my $cmd = "use WebGUI::Form::".$name; eval ($cmd); if ($@) { diff --git a/lib/WebGUI/Macro/LastModified.pm b/lib/WebGUI/Macro/LastModified.pm index 40681ee5d..94c5b2d14 100644 --- a/lib/WebGUI/Macro/LastModified.pm +++ b/lib/WebGUI/Macro/LastModified.pm @@ -20,10 +20,11 @@ use WebGUI::SQL; #------------------------------------------------------------------- sub process { + return '' unless $session{asset}; my ($label, $format, $time); ($label, $format) = WebGUI::Macro::getParams(shift); $format = '%z' if ($format eq ""); - ($time) = WebGUI::SQL->quickArray("SELECT lastUpdated FROM asset where assetId=".quote($session{asset}->getId),WebGUI::SQL->getSlave); + ($time) = WebGUI::SQL->quickArray("SELECT max(revisionDate) FROM assetData where assetId=".quote($session{asset}->getId),WebGUI::SQL->getSlave); return WebGUI::International::get(43,'Asset_Survey') if $time eq 0; return $label.epochToHuman($time,$format) if ($time); } diff --git a/lib/WebGUI/Mail.pm b/lib/WebGUI/Mail.pm index 01bf22a08..05cdbbb58 100644 --- a/lib/WebGUI/Mail.pm +++ b/lib/WebGUI/Mail.pm @@ -104,7 +104,7 @@ sub send { $message .= $_[2]."\n"; #footer $message .= WebGUI::Macro::process("\n".$session{setting}{mailFooter}); - $message .= "\n\n\nThis message was intended for ".$_[0].", but was overridden in the config file.\n\n\n"; + $message .= "\n\n\nThis message was intended for ".$_[0].", but was overridden in the config file.\n\n\n" if ($session{config}{emailOverride}); if ($session{setting}{smtpServer} =~ /\/sendmail/) { if (open(MAIL,"| $session{setting}{smtpServer} -t -oi")) { print MAIL $message; diff --git a/lib/WebGUI/Storage/Image.pm b/lib/WebGUI/Storage/Image.pm index ca86a2ae5..9392339da 100644 --- a/lib/WebGUI/Storage/Image.pm +++ b/lib/WebGUI/Storage/Image.pm @@ -59,7 +59,8 @@ Generates a captcha image (105px x 26px) and returns the filename and challenge sub addFileFromCaptcha { my $self = shift; my $challenge; - $challenge.= ('A'..'Z')[26*rand] foreach (1..6); + srand; + $challenge.= ('A'..'Z')[rand(26)] foreach (1..6); my $filename = "captcha.".WebGUI::Id::generate().".png"; my $image = Image::Magick->new; $image->Set(size=>'105x26'); diff --git a/lib/WebGUI/i18n/English/Asset.pm b/lib/WebGUI/i18n/English/Asset.pm index 31dee6124..be788e25b 100644 --- a/lib/WebGUI/i18n/English/Asset.pm +++ b/lib/WebGUI/i18n/English/Asset.pm @@ -333,7 +333,7 @@ a URL will be made from the parent's URL and the Menu Title.
}, 'extra head tags description' => { - message => q|These tags will be added to the <HEAD> section of each page that the asset appears on.
+ message => q|These tags will be added to the <head> section of each page that the asset appears on.
UI level: 5

|, lastUpdated => 1119149899, @@ -382,9 +382,9 @@ These are the icons and URLs that allow editing, cutting, copying, deleting and }, 'extra head tags' => { - message => q|Extra HEAD tags|, + message => q|Extra <head> elements (tags)|, context => q|label for Asset form|, - lastUpdated => 1106762071, + lastUpdated => 1126381168, }, 'create package' => {