Fix bad Event URL template variables.

This commit is contained in:
Colin Kuskie 2009-04-27 18:39:14 +00:00
parent 15f1391a01
commit 142518035d
6 changed files with 69 additions and 4 deletions

View file

@ -6,6 +6,7 @@
- fixed #10209: Changing existing user profile field type doesn't change underlying database column type
- fixed #10047: SQLReport Debug doesn't catch when bind variables are incorrect
- fixed #10260: WebGUI::Asset::Wobject::Gallery.pm default search date misfunction
- fixed #10238: Edit Calendar Event not working when proxy cache disabled
7.7.4
- rfe: Extend DateTime for Week-Nrs (#9151)

View file

@ -15,6 +15,15 @@ save you many hours of grief.
the requirements for the new type. The most common place this problem
would be noticed would be if a text field was changed to HTML field.
* The Event url template variable was being used incorrectly. This has
been fixed, but requires new template variables for viewing a list
of events, printing events and editing and deleting events. Please
check the online Help for the new template variables.
Event templates using HTML::Template are automatically updated. If your
site uses a different parser for this template it will need to be manually
upgraded.
7.7.4
--------------------------------------------------------------------
* WebGUI now requires XML::FeedPP version 0.40 or greater.

View file

@ -38,6 +38,8 @@ installStoryManagerTables($session);
sm_upgradeConfigFiles($session);
sm_updateDailyWorkflow($session);
correctEventTemplateVariables($session);
finish($session); # this line required
@ -140,6 +142,31 @@ sub sm_updateDailyWorkflow {
print "DONE!\n" unless $quiet;
}
sub correctEventTemplateVariables {
my ($session) = @_;
print "\tCorrect Event Template Variables for URL actions... " unless $quiet;
my $root = WebGUI::Asset->getRoot($session);
my $getATemplate = $root->getLineageIterator(['descendants'], {
returnObjects => 1,
includeOnlyClasses => ['WebGUI::Asset::Template'],
joinClass => 'WebGUI::Asset::Template',
whereClause => q!template.namespace = 'Calendar/Event' and template.parser='WebGUI::Asset::Template::HTMLTemplate'!,
});
TEMPLATE: while (my $templateAsset = $getATemplate->()) {
print("\t\t Correcting ". $templateAsset->getTitle. "\n") unless $quiet;
my $template = $templateAsset->get('template');
$template =~ s{<tmpl_var url>\?func=edit}{<tmpl_var urlEdit>}isg;
$template =~ s{<tmpl_var url>\?func=delete}{<tmpl_var urlDelete>}isg;
$template =~ s{<tmpl_var url>\?print=1}{<tmpl_var urlPrint>}isg;
$template =~ s{<tmpl_var url>\?type=list}{<tmpl_var urlList>}isg;
$templateAsset->update({
template => $template,
});
}
print "DONE!\n" unless $quiet;
}
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
#----------------------------------------------------------------------------

View file

@ -1329,11 +1329,15 @@ sub getTemplateVars {
# Make some friendly URLs
my $urlStartParam = $dtStart->cloneToUserTimeZone->truncate(to => "day");
$var{ "url" } = $self->getUrl;
$var{ "urlEdit" } = $self->getUrl("func=edit");
$var{ "urlPrint" } = $self->getUrl("print=1");
$var{ "urlDelete" } = $self->getUrl("func=delete");
$var{ "urlDay" } = $self->getParent->getUrl("type=day;start=".$urlStartParam);
$var{ "urlWeek" } = $self->getParent->getUrl("type=week;start=".$urlStartParam);
$var{ "urlMonth" } = $self->getParent->getUrl("type=month;start=".$urlStartParam);
$var{ "urlParent" } = $self->getParent->getUrl;
$var{ "urlSearch" } = $self->getParent->getSearchUrl;
$var{ "urlList" } = $self->getParent->getUrl("type=list");
$var{ "urlParent" } = $self->getParent->getUrl;
$var{ "urlSearch" } = $self->getParent->getSearchUrl;
# Related links
$var{ relatedLinks } = $self->getRelatedLinks;

View file

@ -103,10 +103,14 @@ our $HELP = {
{ 'name' => 'dateSpan', },
{ 'name' => 'url', },
{ 'name' => 'urlDay', },
{ 'name' => 'urlList', },
{ 'name' => 'urlWeek', },
{ 'name' => 'urlMonth', },
{ 'name' => 'urlParent', },
{ 'name' => 'urlSearch', },
{ 'name' => 'urlEdit', },
{ 'name' => 'urlPrint', },
{ 'name' => 'urlDelete', },
{ 'name' => 'image.url' },
{ 'name' => 'image.thumbnail' },
{ 'name' => 'attachment.url' },

View file

@ -362,6 +362,11 @@ our $I18N = {
lastUpdated => 1171043883,
},
'urlList' => {
message => q|A URL to show Events as a list, rather than a calendar.|,
lastUpdated => 1240635548,
},
'urlWeek' => {
message => q|A URL to show all Events on the same week in this Event's Calendar.|,
lastUpdated => 1171043883,
@ -373,8 +378,8 @@ our $I18N = {
},
'urlParent' => {
message => q|A URL the Calendar that contains this Event.|,
lastUpdated => 1172693361,
message => q|A URL to the Calendar that contains this Event.|,
lastUpdated => 1240635921,
},
'urlSearch' => {
@ -382,6 +387,21 @@ our $I18N = {
lastUpdated => 1172693363,
},
'urlEdit' => {
message => q|A URL to edit this Event.|,
lastUpdated => 1240635940,
},
'urlPrint' => {
message => q|A URL to render this Event with its template for printing.|,
lastUpdated => 1240635974,
},
'urlDelete' => {
message => q|A URL to delete this Event.|,
lastUpdated => 1240635972,
},
'relatedLinks' => {
message => q|This loop contains all links from this Event's set of related links.|,
lastUpdated => 1171043883,