Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F804032
D202.id695.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Feb 26, 9:04 AM
Size
10 KB
Mime Type
text/x-diff
Expires
Thu, Feb 27, 9:04 AM (4 h, 39 m)
Engine
blob
Format
Raw Data
Handle
576746
Attached To
D202: INP-1532 Allow specifying scheduled time for Promo Blocks
D202.id695.diff
View Options
Index: branches/5.3.x/core/admin_templates/promo_blocks/promo_block_edit.tpl
===================================================================
--- branches/5.3.x/core/admin_templates/promo_blocks/promo_block_edit.tpl
+++ branches/5.3.x/core/admin_templates/promo_blocks/promo_block_edit.tpl
@@ -66,12 +66,6 @@
</label>
</inp2:m_DefineElement>
-<inp2:m_DefineElement name="date_field_caption_element">
- <label for="<inp2:m_param name='NamePrefix'/><inp2:{$prefix}_InputName field='$field'/>">
- <span class="<inp2:m_if check='{$prefix}_HasError' field='$field'>error-cell</inp2:m_if>"><inp2:m_if check="m_Param" name="title"><inp2:m_phrase label="$title"/></inp2:m_else/><inp2:m_Param name="title_text"/></inp2:m_if> <span class="small">(<inp2:promo-block_Format field="ScheduleFromDate_date" input_format="1" human="true"/>)</span></span></span><inp2:m_if check="{$prefix}_IsRequired" field="$field"><span class="field-required"> *</span></inp2:m_if>:<inp2:m_if check="m_Param" name="hint_label"><span> <img src="<inp2:m_TemplatesBase/>/img/hint_icon.png" width="12" height="13" title="<inp2:m_Phrase label='$hint_label' html_escape='1'/>" alt="<inp2:m_Phrase label='$hint_label' html_escape='1'/>"/></inp2:m_if>
- </label>
-</inp2:m_DefineElement>
-
<inp2:promo-block_SaveWarning name="grid_save_warning"/>
<inp2:promo-block_ErrorWarning name="form_error_warning"/>
@@ -98,61 +92,8 @@
<inp2:m_RenderElement name="inp_edit_options" prefix="promo-block" field="CategoryId" title="la_fld_Category" style="width: 400px;" has_empty="1"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="promo-block" field="ExternalLink"/>
<inp2:m_RenderElement name="inp_edit_checkbox" prefix="promo-block" field="OpenInNewWindow"/>
-
- <inp2:m_RenderElement design="form_row" caption_render_as="date_field_caption_element" prefix="promo-block" field="ScheduleFromDate" title="la_fld_ScheduleDate" to_field="ScheduleToDate">
- <td class="control-cell">
- <inp2:m_Phrase label="la_From"/>
- <input type="text" name="<inp2:{$prefix}_InputName field="{$field}_date"/>" id="<inp2:{$prefix}_InputName field="{$field}_date"/>" value="<inp2:{$prefix}_Field field="{$field}_date" format="_regional_InputDateFormat"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:{$prefix}_Format field="{$field}_date" input_format="1" edit_size="edit_size"/>" datepickerIcon="<inp2:m_ProjectBase/>core/admin_templates/img/calendar_icon.gif">
- <img src="img/calendar_icon.gif" id="cal_img_<inp2:{$prefix}_InputName field="{$field}"/>"
- style="cursor: pointer; margin-right: 5px"
- title="Date selector"
- />
-
- <script type="text/javascript">
- Calendar.setup({
- inputField : "<inp2:{$prefix}_InputName field="{$field}_date"/>",
- ifFormat : Calendar.phpDateFormat("<inp2:{$prefix}_Format field="{$field}_date" input_format="1"/>"),
- button : "cal_img_<inp2:{$prefix}_InputName field="{$field}"/>",
- align : "br",
- singleClick : true,
- showsTime : true,
- weekNumbers : false,
- firstDay : <inp2:m_GetConfig var="FirstDayOfWeek"/>,
- onUpdate : function(cal) {
- runOnChange('<inp2:$prefix_InputName field="{$field}_date"/>');
- }
- });
- </script>
- <input type="hidden" name="<inp2:{$prefix}_InputName field="{$field}_time"/>" id="<inp2:{$prefix}_InputName field="{$field}_time" input_format="1"/>" value="">
-
-
- <inp2:m_Phrase label="la_To"/>
- <input type="text" name="<inp2:{$prefix}_InputName field="{$to_field}_date"/>" id="<inp2:{$prefix}_InputName field="{$to_field}_date"/>" value="<inp2:{$prefix}_Field field="{$to_field}_date" format="_regional_InputDateFormat"/>" tabindex="<inp2:m_get param="tab_index"/>" size="<inp2:{$prefix}_Format field="{$to_field}_date" input_format="1" edit_size="edit_size"/>" datepickerIcon="<inp2:m_ProjectBase/>core/admin_templates/img/calendar_icon.gif">
- <img src="img/calendar_icon.gif" id="cal_img_<inp2:{$prefix}_InputName field="{$to_field}"/>"
- style="cursor: pointer; margin-right: 5px"
- title="Date selector"
- />
-
- <script type="text/javascript">
- Calendar.setup({
- inputField : "<inp2:{$prefix}_InputName field="{$to_field}_date"/>",
- ifFormat : Calendar.phpDateFormat("<inp2:{$prefix}_Format field="{$to_field}_date" input_format="1"/>"),
- button : "cal_img_<inp2:{$prefix}_InputName field="{$to_field}"/>",
- align : "br",
- singleClick : true,
- showsTime : true,
- weekNumbers : false,
- firstDay : <inp2:m_GetConfig var="FirstDayOfWeek"/>,
- onUpdate : function(cal) {
- runOnChange('<inp2:$prefix_InputName field="{$to_field}_date"/>');
- }
- });
- </script>
- <input type="hidden" name="<inp2:{$prefix}_InputName field="{$to_field}_time"/>" id="<inp2:{$prefix}_InputName field="{$to_field}_time" input_format="1"/>" value="">
-
- </td>
- </inp2:m_RenderElement>
-
+ <inp2:m_RenderElement name="inp_edit_date_time" prefix="promo-block" field="ScheduleFromDate"/>
+ <inp2:m_RenderElement name="inp_edit_date_time" prefix="promo-block" field="ScheduleToDate"/>
<inp2:m_RenderElement name="inp_edit_checkbox" prefix="promo-block" field="Sticky"/>
<inp2:m_ifnot check="promo-block_IsNewItem">
Index: branches/5.3.x/core/install/english.lang
===================================================================
--- branches/5.3.x/core/install/english.lang
+++ branches/5.3.x/core/install/english.lang
@@ -297,6 +297,7 @@
<PHRASE Label="la_error_unknown_category" Module="Core" Type="1">VW5rbm93biBzZWN0aW9u</PHRASE>
<PHRASE Label="la_error_UserBanned" Module="Core" Type="1">VXNlciBCYW5uZWQ=</PHRASE>
<PHRASE Label="LA_ERROR_USERNOTFOUND" Module="Core" Type="1">dXNlciBub3QgZm91bmQ=</PHRASE>
+ <PHRASE Label="la_error_WrongPromoBlockScheduleInterval" Module="Core" Type="1">IlNjaGVkdWxlZCBUbyIgZGF0ZS90aW1lIG11c3QgYmUgYmVmb3JlICJTY2hlZHVsZWQgRnJvbSI=</PHRASE>
<PHRASE Label="la_error_YouMustSelectOnlyOneUser" Module="Core" Type="1">WW91IG11c3Qgc2VsZWN0IG9ubHkgb25lIHVzZXI=</PHRASE>
<PHRASE Label="la_err_bad_date_format" Module="Core" Type="1">SW5jb3JyZWN0IGRhdGUgZm9ybWF0LCBwbGVhc2UgdXNlICglcykgZXguICglcyk=</PHRASE>
<PHRASE Label="la_err_bad_type" Module="Core" Type="1">SW5jb3JyZWN0IGRhdGEgZm9ybWF0LCBwbGVhc2UgdXNlIHt0eXBlfQ==</PHRASE>
@@ -658,7 +659,8 @@
<PHRASE Label="la_fld_RunSchedule" Module="Core" Type="1" Column="UnVuIFNjaGVkdWxl">UnVuIFNjaGVkdWxl</PHRASE>
<PHRASE Label="la_fld_RunTime" Module="Core" Type="1" Column="UnVuIFRpbWU=">UnVuIFRpbWU=</PHRASE>
<PHRASE Label="la_fld_SameAsThumb" Module="Core" Type="1">U2FtZSBBcyBUaHVtYg==</PHRASE>
- <PHRASE Label="la_fld_ScheduleDate" Module="Core" Type="1">U2NoZWR1bGUgRGF0ZQ==</PHRASE>
+ <PHRASE Label="la_fld_ScheduleFromDate" Module="Core" Type="1" Column="U2NoZWR1bGUgRnJvbQ==">U2NoZWR1bGUgRnJvbQ==</PHRASE>
+ <PHRASE Label="la_fld_ScheduleToDate" Module="Core" Type="1" Column="U2NoZWR1bGUgVG8=">U2NoZWR1bGUgVG8=</PHRASE>
<PHRASE Label="la_fld_SearchTerm" Module="Core" Type="1" Column="U2VhcmNoIFRlcm0=">U2VhcmNoIFRlcm0=</PHRASE>
<PHRASE Label="la_fld_Sender" Module="Core" Type="1" Column="U2VuZGVy">U2VuZGVy</PHRASE>
<PHRASE Label="la_fld_SenderAddress" Module="Core" Type="1">U2VuZGVyJ3MgQWRkcmVzcw==</PHRASE>
Index: branches/5.3.x/core/install/upgrades.sql
===================================================================
--- branches/5.3.x/core/install/upgrades.sql
+++ branches/5.3.x/core/install/upgrades.sql
@@ -3049,3 +3049,6 @@
ADD INDEX (`Status`);
INSERT INTO SystemSettings VALUES(DEFAULT, 'SessionLogRotationInterval', '2629800', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsLogs', 'la_config_SessionLogRotationInterval', 'select', '', '86400=la_opt_OneDay||604800=la_opt_OneWeek||1209600=la_opt_TwoWeeks||2629800=la_opt_OneMonth||7889400=la_opt_ThreeMonths||31557600=la_opt_OneYear||63115200=la_opt_TwoYears||94672800=la_opt_ThreeYears||157788000=la_opt_FiveYears||-1=la_opt_EmailLogKeepForever', 65.05, 0, 1, NULL);
+
+UPDATE PromoBlocks SET ScheduleToDate = ScheduleToDate + 86399 WHERE DATE_FORMAT(FROM_UNIXTIME(ScheduleTodate), "%H%i") = "0000";
+DELETE FROM LanguageLabels WHERE PhraseKey = "LA_FLD_SCHEDULEDATE";
Index: branches/5.3.x/core/units/promo_blocks/promo_block_eh.php
===================================================================
--- branches/5.3.x/core/units/promo_blocks/promo_block_eh.php
+++ branches/5.3.x/core/units/promo_blocks/promo_block_eh.php
@@ -197,11 +197,12 @@
/** @var kDBItem $object */
$object = $event->getObject();
- $date_from = $object->GetDBField('ScheduleFromDate_date');
- $date_to = $object->GetDBField('ScheduleToDate_date');
+ $object->UpdateFormattersMasterFields();
+ $date_from = $object->GetDBField('ScheduleFromDate');
+ $date_to = $object->GetDBField('ScheduleToDate');
if ( $date_from && $date_to && $date_from >= $date_to ) {
- $object->SetError('ScheduleFromDate_date', 'wrong_date_interval');
+ $object->SetError('ScheduleFromDate', 'wrong_date_interval');
}
$object->setRequired('CategoryId', $object->GetDBField('LinkType') == PromoBlockType::INTERNAL);
Index: branches/5.3.x/core/units/promo_blocks/promo_blocks_config.php
===================================================================
--- branches/5.3.x/core/units/promo_blocks/promo_blocks_config.php
+++ branches/5.3.x/core/units/promo_blocks/promo_blocks_config.php
@@ -104,13 +104,13 @@
),
'ScheduleFromDate' => Array (
'type' => 'int',
- 'formatter' => 'kDateFormatter', 'time_format' => '', 'input_time_format' => '',
- 'error_msgs' => Array ('wrong_date_interval' => '!la_ToDateMustBeGreaterThanFromDate!'),
+ 'formatter' => 'kDateFormatter', 'picker_default' => 'midnight',
+ 'error_msgs' => array('wrong_date_interval' => '!la_error_WrongPromoBlockScheduleInterval!'),
'default' => null,
),
'ScheduleToDate' => Array (
'type' => 'int',
- 'formatter' => 'kDateFormatter', 'time_format' => '', 'input_time_format' => '',
+ 'formatter' => 'kDateFormatter', 'picker_default' => 'midnight +1 day -1 second',
'error_field' => 'ScheduleFromDate',
'default' => null,
),
@@ -144,4 +144,4 @@
),
),
),
-);
\ No newline at end of file
+);
Event Timeline
Log In to Comment