Merge commit 'v7.10.15' into 8

Conflicts:
	docs/gotcha.txt
	docs/previousVersion.sql
	docs/templates.txt
	lib/WebGUI.pm
	lib/WebGUI/Asset.pm
	lib/WebGUI/Asset/Event.pm
	lib/WebGUI/Asset/File.pm
	lib/WebGUI/Asset/MapPoint.pm
	lib/WebGUI/Asset/RichEdit.pm
	lib/WebGUI/Asset/Sku/Product.pm
	lib/WebGUI/Asset/Snippet.pm
	lib/WebGUI/Asset/Story.pm
	lib/WebGUI/Asset/Template.pm
	lib/WebGUI/Asset/Template/TemplateToolkit.pm
	lib/WebGUI/Asset/Wobject/Calendar.pm
	lib/WebGUI/Asset/Wobject/Carousel.pm
	lib/WebGUI/Asset/Wobject/Collaboration.pm
	lib/WebGUI/Asset/Wobject/Dashboard.pm
	lib/WebGUI/Asset/Wobject/DataForm.pm
	lib/WebGUI/Asset/Wobject/Folder.pm
	lib/WebGUI/Asset/Wobject/Map.pm
	lib/WebGUI/Asset/Wobject/Search.pm
	lib/WebGUI/Asset/Wobject/Shelf.pm
	lib/WebGUI/Asset/Wobject/StockData.pm
	lib/WebGUI/Asset/Wobject/StoryTopic.pm
	lib/WebGUI/Asset/Wobject/SyndicatedContent.pm
	lib/WebGUI/Asset/Wobject/Thingy.pm
	lib/WebGUI/Asset/Wobject/WeatherData.pm
	lib/WebGUI/AssetClipboard.pm
	lib/WebGUI/AssetCollateral/DataForm/Entry.pm
	lib/WebGUI/AssetExportHtml.pm
	lib/WebGUI/AssetLineage.pm
	lib/WebGUI/AssetMetaData.pm
	lib/WebGUI/AssetTrash.pm
	lib/WebGUI/AssetVersioning.pm
	lib/WebGUI/Auth.pm
	lib/WebGUI/Cache/CHI.pm
	lib/WebGUI/Content/AssetManager.pm
	lib/WebGUI/Fork/ProgressBar.pm
	lib/WebGUI/Form/JsonTable.pm
	lib/WebGUI/Form/TimeField.pm
	lib/WebGUI/Form/Zipcode.pm
	lib/WebGUI/Group.pm
	lib/WebGUI/International.pm
	lib/WebGUI/Macro/AssetProxy.pm
	lib/WebGUI/Macro/FileUrl.pm
	lib/WebGUI/Operation/SSO.pm
	lib/WebGUI/Operation/User.pm
	lib/WebGUI/Role/Asset/Subscribable.pm
	lib/WebGUI/Shop/Cart.pm
	lib/WebGUI/Shop/Transaction.pm
	lib/WebGUI/Shop/TransactionItem.pm
	lib/WebGUI/Test.pm
	lib/WebGUI/URL/Content.pm
	lib/WebGUI/URL/Uploads.pm
	lib/WebGUI/User.pm
	lib/WebGUI/Workflow/Activity/ExtendCalendarRecurrences.pm
	lib/WebGUI/Workflow/Activity/SendNewsletters.pm
	lib/WebGUI/i18n/English/Asset.pm
	lib/WebGUI/i18n/English/WebGUI.pm
	sbin/installClass.pl
	sbin/rebuildLineage.pl
	sbin/search.pl
	sbin/testEnvironment.pl
	t/Asset/Asset.t
	t/Asset/AssetClipboard.t
	t/Asset/AssetLineage.t
	t/Asset/AssetMetaData.t
	t/Asset/Event.t
	t/Asset/File.t
	t/Asset/File/Image.t
	t/Asset/Post/notification.t
	t/Asset/Sku.t
	t/Asset/Story.t
	t/Asset/Template.t
	t/Asset/Wobject/Collaboration/templateVariables.t
	t/Asset/Wobject/Collaboration/unarchiveAll.t
	t/Asset/Wobject/Shelf.t
	t/Auth.t
	t/Macro/EditableToggle.t
	t/Macro/FilePump.t
	t/Shop/Cart.t
	t/Shop/Transaction.t
	t/Storage.t
	t/User.t
	t/Workflow.t
This commit is contained in:
Doug Bell 2011-05-13 18:15:11 -05:00
commit 277faae8a1
783 changed files with 32041 additions and 25495 deletions

View file

@ -27,6 +27,7 @@ use WebGUI::Storage;
use Test::Deep::NoTest qw(eq_deeply);
use DateTime::Event::ICal;
use DateTime::Set;
use Data::ICal::Entry::Event;
use Moose;
use WebGUI::Definition::Asset;
@ -212,6 +213,54 @@ override addRevision => sub {
return $newRev;
};
####################################################################
=head2 add_to_calendar ($iCal)
Build a Data::ICal::Entry::Event object that contains the information for this
event and add it to the Data::ICal calendar
=head3 $iCal
A Data::ICal object, representing the top-level calendar instance.
=cut
sub add_to_calendar {
my $self = shift;
my $session = $self->session;
my $calendar = shift;
my $event = Data::ICal::Entry::Event->new();
$event->add_properties(
'last-modified' => WebGUI::DateTime->new($session, $event->get("revisionDate"))->toIcal,
created => WebGUI::DateTime->new($session, $event->get("creationDate"))->toIcal,
sequence => $self->get('iCalSequenceNumber'),
summary => $self->get('title'),
description => $self->get('description'),
location => $self->get('location'),
uid => $self->get('feedUid')
? $self->get('feedUid')
: $self->get('assetId') . '@'. $session->config->get("sitename")->[0],
);
##WebGUI Specific fields
foreach my $prop (qw/groupIdView groupIdEdit url menuTitle timeZone/) {
$event->add_property( 'x-webgui-'.lc($prop) => $self->get($prop));
}
my $eventStart = $self->getIcalStart;
my $start_parameters = {};
if (! $eventStart =~ /T/) {
$start_parameters->{VALUE} = 'DATE';
}
$event->add_property(dtstart => [ $eventStart, $start_parameters ]);
my $eventEnd = $self->getIcalEnd;
my $end_parameters = {};
if (! $eventEnd =~ /T/) {
$end_parameters->{VALUE} = 'DATE';
}
$event->add_property(dtend => [ $eventEnd, $end_parameters ]);
$calendar->add_entry($event);
}
{
my %dayNamesToICal = (
@ -411,6 +460,14 @@ sub duplicate {
my $newAsset = $self->SUPER::duplicate(@_);
my $newStorage = $self->getStorageLocation->copy;
$newAsset->update({storageId=>$newStorage->getId});
my $links = $self->getRelatedLinks();
my $id = $self->session->id;
foreach my $link (@{ $links }) {
$link->{new_event} = 1;
$link->{eventlinkId} = $id->generate;
$link->{linkurl} = $link->{linkURL};
}
$newAsset->setRelatedLinks($links);
return $newAsset;
}
@ -434,13 +491,12 @@ sub generateRecurrence {
WHERE recurId = ? AND startDate = ?
};
my $db = $self->session->db;
unless ($db->quickScalar($sql, [$self->recurId, $sdb])) {
my $child = $self->get;
$child->{startDate} = $sdb;
$child->{endDate} = $edb;
$self->getParent->addChild(
$child, undef, undef, { skipAutoCommitWorkflows => 1 }
);
unless ($db->quickScalar($sql, [$self->get('recurId'), $sdb])) {
my $child = $self->duplicate({skipAutoCommitWorkflows => 1});
$child->update({
startDate => $sdb,
endDate => $edb,
});
}
}
@ -1374,9 +1430,18 @@ override processEditForm => sub {
### Verify the form was filled out correctly...
my @errors;
# If the start date is after the end date
my $i18n = WebGUI::International->new($session, 'Asset_Event');
if ($self->startDate gt $self->endDate) {
# Verify we got valid dates
if ( !eval{ $self->getDateTimeStart; 1 } ) {
push @errors, $i18n->get('invalid start date');
}
if ( !eval{ $self->getDateTimeEnd; 1 } ) {
push @errors, $i18n->get('invalid end date');
}
# If the start date is after the end date
if ($self->get("startDate") gt $self->get("endDate")) {
push @errors, $i18n->get("The event end date must be after the event start date.");
}
@ -1605,13 +1670,17 @@ Extent the method from the super class to delete all storage locations.
override purge => sub {
my $self = shift;
my $sth = $self->session->db->read("select storageId from Event where assetId=?",[$self->getId]);
while (my ($storageId) = $sth->array) {
my $storage = WebGUI::Storage->get($self->session,$storageId);
my $id = $self->getId;
my $session = $self->session;
my @storageIds = $session->db->buildArray("select storageId from Event where assetId=?",[$id]);
my $success = $self->SUPER::purge;
return 0 unless $success;
foreach my $storageId (@storageIds) {
my $storage = WebGUI::Storage->get($session, $storageId);
$storage->delete if defined $storage;
}
$sth->finish;
return super();
$session->db->write('delete from Event_relatedlink where assetId=?',[$id]);
return 1;
};
#-------------------------------------------------------------------
@ -2235,20 +2304,24 @@ sub www_edit {
# End
$var->{"formRecurEnd"}
= q|
<div><input type="radio" name="recurEndType" id="recurEndType_none" value="none" |.(!$recur->{endDate} && !$recur->{endAfter} ? 'checked="checked"' : '').q|/>
<label for="recurEndType_none">|. $i18n->get('No end'). q|</label><br />
<div><input type="radio" name="recurEndType" id="recurEndType_none" value="none" |.(!$recur->{endDate} && !$recur->{endAfter} ? 'checked="checked"' : '').q| onclick="toggleRecurEnd()"/>
<label for="recurEndType_none">|. $i18n->get('No end'). q|</label>
<input type="radio" name="recurEndType" id="recurEndType_date" value="date" |.($recur->{endDate} ? 'checked="checked"' : '' ).q| />
<label for="recurEndType_date">|. $i18n->get('By date'). q| </label>|
<input type="radio" name="recurEndType" id="recurEndType_date" value="date" |.($recur->{endDate} ? 'checked="checked"' : '' ).q| onclick="toggleRecurEnd()"/>
<label for="recurEndType_date">|. $i18n->get('By date'). q| </label>
<div id="recurEndPattern_date"> |
. WebGUI::Form::date($session,{ name => "recurEndDate", value => $recur->{endDate}, defaultValue => $recur->{endDate} })
. q|
<br />
</div>
<input type="radio" name="recurEndType" id="recurEndType_after" value="after" |.($recur->{endAfter} ? 'checked="checked"' : '' ).q| />
<input type="radio" name="recurEndType" id="recurEndType_after" value="after" |.($recur->{endAfter} ? 'checked="checked"' : '' ).q| onclick="toggleRecurEnd()"/>
<label for="recurEndType_after">|. $i18n->get('After'). q| </label>
<div id="recurEndPattern_after">
<input type="text" size="3" name="recurEndAfter" value="|.$recur->{endAfter}.q|" />
|. $i18n->get('occurences'). q|.
</div>
</div>
|;
# Include
@ -2310,7 +2383,19 @@ sub www_edit {
document.getElementById("recurPattern_yearly").style.display = "block";
}
}
YAHOO.util.Event.onAvailable("recurPattern",function(e) { toggleRecur(); });
function toggleRecurEnd() {
document.getElementById("recurEndPattern_date").style.display = "none";
document.getElementById("recurEndPattern_after").style.display = "none";
if (document.getElementById("recurEndType_date").checked) {
document.getElementById("recurEndPattern_date").style.display = "block";
}
else if (document.getElementById("recurEndType_after").checked) {
document.getElementById("recurEndPattern_after").style.display = "block";
}
}
YAHOO.util.Event.onAvailable("recurPattern",function(e) { toggleRecur(); toggleRecurEnd(); });
</script>
ENDJS