Permalink
Browse files

BUGFIX Correctly set user timezone in workflow (mostly applies to cus…

…tomisations with timezone as a DropdownField rather than a HiddenField, see AIR-92)
  • Loading branch information...
1 parent c88bbc4 commit 5319ea1b01b54317ae3e7f77a6e337fb9491919b @chillu chillu committed Jan 24, 2012
@@ -50,19 +50,22 @@ function cms_setembargoexpiry($data) {
if (isset($data['EmbargoDate'])) {
$embargoField->setValue($data['EmbargoDate']);
+ $tz = @$data['EmbargoDate']['timezone'];
+ if($tz) $embargoField->setConfig('usertimezone', $tz);
$embargoDate = $embargoField->Value();
$embargoTimestamp = strtotime($embargoField->Value());
}
if (isset($data['ExpiryDate'])) {
$expiryField->setValue($data['ExpiryDate']);
+ $tz = @$data['ExpiryDate']['timezone'];
+ if($tz) $expiryField->setConfig('usertimezone', $tz);
$expiryDate = $expiryField->Value();
$expiryTimestamp = strtotime($expiryField->Value());
}
$embargoField->saveInto($wfRequest);
$expiryField->saveInto($wfRequest->Page());
-
$embargoTimestamp = strtotime($embargoField->dataValue());
$expiryTimestamp = strtotime($expiryField->dataValue());
@@ -233,7 +233,7 @@ var EmbargoExpiry = {
saveButton: 'saveExpiryButton',
dateField: 'ExpiryDate-date',
timeField: 'ExpiryDate-time',
- timezoneField: 'ExpiryDate_TimeZone',
+ timezoneField: 'ExpiryDate-timezone',
wholeMessage: 'embargoExpiry-expiryStatus',
dateTime: 'expiryDate',
what: 'expiry'
@@ -244,7 +244,7 @@ var EmbargoExpiry = {
saveButton: 'saveEmbargoButton',
dateField: 'EmbargoDate-date',
timeField: 'EmbargoDate-time',
- timezoneField: 'EmbargoDate_TimeZone',
+ timezoneField: 'EmbargoDate-timezone',
wholeMessage: 'embargoExpiry-embargoStatus',
dateTime: 'embargoDate',
what: 'embargo'
@@ -73,14 +73,14 @@
<% if EmbargoField %>
<p id="embargoExpiry-embargoStatus" style="display:<% if EmbargoDate %>block<% else %>none<% end_if %>">
- This page is currently scheduled to be published at <span id="embargoDate">$EmbargoDate.Nice</span><% if ExpiryField.DefaultTimezoneName %>, $ExpiryField.DefaultTimezoneName time<% end_if %>.
+ This page is currently scheduled to be published at <span id="embargoDate">$EmbargoDate.Nice</span><% if ExpiryField.TimezoneName %>, $ExpiryField.TimezoneName time<% end_if %>.
<% if Status = Scheduled %><a href="$ViewEmbargoedLink" target="_blank">View site on date</a><% end_if %>
</p>
<% end_if %>
<% if ExpiryField %>
<p id="embargoExpiry-expiryStatus" style="display:<% if ExpiryDate %>block<% else %>none<% end_if %>">
- This page is currently scheduled to be unpublished at <span id="expiryDate">$Page.ExpiryDate.Nice</span><% if ExpiryField.DefaultTimezoneName %>, $ExpiryField.DefaultTimezoneName time<% end_if %>.
+ This page is currently scheduled to be unpublished at <span id="expiryDate">$Page.ExpiryDate.Nice</span><% if ExpiryField.TimezoneName %>, $ExpiryField.TimezoneName time<% end_if %>.
<% if Status = Scheduled %><a href="$ViewExpiredLink" target="_blank">View site on date</a><% end_if %>
</p>
<% end_if %>

0 comments on commit 5319ea1

Please sign in to comment.