Index: admin_templates/promo_blocks/promo_block_edit.tpl =================================================================== --- admin_templates/promo_blocks/promo_block_edit.tpl (revision 15359) +++ admin_templates/promo_blocks/promo_block_edit.tpl (working copy) @@ -79,8 +79,9 @@ - + + @@ -92,7 +93,7 @@ - + Index: admin_templates/promo_blocks/promo_block_list.tpl =================================================================== --- admin_templates/promo_blocks/promo_block_list.tpl (revision 15359) +++ admin_templates/promo_blocks/promo_block_list.tpl (working copy) @@ -1,67 +1,138 @@ - +
- + Index: install/install_schema.sql =================================================================== --- install/install_schema.sql (revision 15363) +++ install/install_schema.sql (working copy) @@ -1324,9 +1324,18 @@ CREATE TABLE PromoBlocks ( BlockId int(11) NOT NULL AUTO_INCREMENT, - Title varchar(50) NOT NULL DEFAULT '', + l1_Title varchar(50) NOT NULL DEFAULT '', + l2_Title varchar(50) NOT NULL DEFAULT '', + l3_Title varchar(50) NOT NULL DEFAULT '', + l4_Title varchar(50) NOT NULL DEFAULT '', + l5_Title varchar(50) NOT NULL DEFAULT '', + l1_ButtonText varchar(255) NOT NULL DEFAULT '', + l2_ButtonText varchar(255) NOT NULL DEFAULT '', + l3_ButtonText varchar(255) NOT NULL DEFAULT '', + l4_ButtonText varchar(255) NOT NULL DEFAULT '', + l5_ButtonText varchar(255) NOT NULL DEFAULT '', Priority int(11) NOT NULL DEFAULT '0', - Status tinyint(1) NOT NULL DEFAULT '1', + `Status` tinyint(1) NOT NULL DEFAULT '1', l1_Image varchar(255) NOT NULL DEFAULT '', l2_Image varchar(255) NOT NULL DEFAULT '', l3_Image varchar(255) NOT NULL DEFAULT '', @@ -1334,7 +1343,7 @@ l5_Image varchar(255) NOT NULL DEFAULT '', CSSClassName varchar(255) NOT NULL DEFAULT '', LinkType tinyint(1) NOT NULL DEFAULT '1', - CategoryId INT(11) DEFAULT NULL, + CategoryId int(11) DEFAULT NULL, ExternalLink varchar(255) NOT NULL DEFAULT '', OpenInNewWindow tinyint(3) unsigned NOT NULL DEFAULT '0', ScheduleFromDate int(11) DEFAULT NULL, @@ -1350,7 +1359,17 @@ PromoBlockGroupId int(10) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (BlockId), KEY OpenInNewWindow (OpenInNewWindow), - KEY PromoBlockGroupId (PromoBlockGroupId) + KEY PromoBlockGroupId (PromoBlockGroupId), + KEY l1_Title (l1_Title(5)), + KEY l2_Title (l2_Title(5)), + KEY l3_Title (l3_Title(5)), + KEY l4_Title (l4_Title(5)), + KEY l5_Title (l5_Title(5)), + KEY l1_ButtonText (l1_ButtonText(5)), + KEY l2_ButtonText (l2_ButtonText(5)), + KEY l3_ButtonText (l3_ButtonText(5)), + KEY l4_ButtonText (l4_ButtonText(5)), + KEY l5_ButtonText (l5_ButtonText(5)) ); CREATE TABLE PromoBlockGroups ( Index: install/upgrades.php =================================================================== --- install/upgrades.php (revision 15359) +++ install/upgrades.php (working copy) @@ -2146,4 +2146,33 @@ return '$body' . "\n" . str_replace(Array ("\r\n", "\r"), "\n", $string); } + + /** + * Update to 5.2.0-RC1 + * + * @param string $mode when called mode {before, after) + */ + public function Upgrade_5_2_0_RC1($mode) + { + if ( $mode != 'before' ) { + return; + } + + $ml_helper = $this->Application->recallObject('kMultiLanguageHelper'); + /* @var $ml_helper kMultiLanguageHelper */ + + $ml_helper->createFields('promo-block'); + + $table_name = $this->Application->getUnitOption('promo-block', 'TableName'); + $table_structure = $this->Conn->Query('DESCRIBE ' . $table_name, 'Field'); + + if ( isset($table_structure['Title']) ) { + $sql = 'UPDATE ' . $table_name . ' + SET l' . $this->Application->GetDefaultLanguageId() . '_Title = Title'; + $this->Conn->Query($sql); + + $sql = 'ALTER TABLE ' . $table_name . ' DROP Title'; + $this->Conn->Query($sql); + } + } } \ No newline at end of file Index: install/upgrades.sql =================================================================== --- install/upgrades.sql (revision 15363) +++ install/upgrades.sql (working copy) @@ -2749,4 +2749,4 @@ # ===== v 5.2.0-RC1 ===== UPDATE LanguageLabels SET l<%PRIMARY_LANGUAGE%>_Translation = '<TITLE> Tag' WHERE PhraseKey = 'LA_FLD_PAGECONTENTTITLE'; ALTER TABLE EmailLog ADD EventType TINYINT(4) NULL AFTER EventName; -DELETE FROM UserPersistentSessionData WHERE VariableName = 'email-log[Default]columns_.'; +DELETE FROM UserPersistentSessionData WHERE VariableName IN ('email-log[Default]columns_.', 'promo-block[Default]columns_.'); Index: units/promo_blocks/promo_block_eh.php =================================================================== --- units/promo_blocks/promo_block_eh.php (revision 15359) +++ units/promo_blocks/promo_block_eh.php (working copy) @@ -332,7 +332,7 @@ 'formatter' => 'kUploadFormatter', 'upload_dir' => IMAGES_PATH . 'promo_blocks/', 'multiple' => 1, 'thumb_format' => 'resize:100x100', 'file_types' => '*.jpg;*.gif;*.png', 'files_description' => '!la_hint_ImageFiles!', - 'required' => 1, 'not_null' => 1, 'default' => '', + 'not_null' => 1, 'default' => '', ); // get active languages @@ -340,10 +340,12 @@ FROM ' . TABLE_PREFIX . 'Languages'; $languages = $this->Conn->GetCol($sql); - foreach ($languages AS $lang_id) { + foreach ($languages as $lang_id) { $fields['l' . $lang_id . '_Image'] = $a_image; } + $fields['l' . $this->Application->GetDefaultLanguageId() . '_Image']['required'] = 1; + $this->Application->setUnitOption($event->Prefix, 'Fields', $fields); } } Index: units/promo_blocks/promo_blocks_config.php =================================================================== --- units/promo_blocks/promo_blocks_config.php (revision 15359) +++ units/promo_blocks/promo_blocks_config.php (working copy) @@ -23,6 +23,8 @@ 'TitleField' => 'Title', + 'StatusField' => Array ('Status'), + 'TitlePresets' => Array ( 'default' => Array ( 'new_status_labels' => Array ('promo-block' => '!la_title_AddingPromoBlock!'), @@ -60,8 +62,12 @@ ), 'Title' => Array ( 'type' => 'string', 'max_len' => 50, - 'not_null' => 1, 'required' => 1, 'default' => '', + 'formatter' => 'kMultiLanguage', 'db_type' => 'varchar(50)', 'not_null' => 1, 'required' => 1, 'default' => '', ), + 'ButtonText' => Array ( + 'type' => 'string', 'max_len' => 255, + 'formatter' => 'kMultiLanguage', 'db_type' => 'varchar(255)', 'not_null' => 1, 'default' => '', + ), 'Status' => Array ( 'type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Enabled', 0 => 'la_Disabled'), 'use_phrases' => 1, @@ -77,12 +83,12 @@ 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 0, ), - 'CSSClassName' => Array( + /*'CSSClassName' => Array( 'type' => 'string', 'formatter' => 'kOptionsFormatter', 'options' => Array('promo-orange' => 'Orange', 'promo-green' => 'Green', 'promo-blue' => 'Blue'), 'not_null' => 1, 'default' => '', - ), + ),*/ 'LinkType' => Array ( 'type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_opt_Internal', 2 => 'la_opt_External'), 'use_phrases' => 1, @@ -109,7 +115,7 @@ ), 'NumberOfClicks' => Array ('type' => 'int', 'default' => 0, 'not_null' => 1), 'NumberOfViews' => Array ('type' => 'int', 'default' => 0, 'not_null' => 1), - 'Html' => Array ('type' => 'string', 'formatter' => 'kMultiLanguage', 'using_fck' => 1, 'default' => null), + 'Html' => Array ('type' => 'string', 'formatter' => 'kMultiLanguage', 'db_type' => 'text', 'using_fck' => 1, 'default' => null), ), 'VirtualFields' => Array( @@ -118,21 +124,22 @@ 'Grids' => Array ( 'Default' => Array ( + 'Icons' => Array ('default' => 'icon16_item.png', 0 => 'icon16_disabled.png'), 'Fields' => Array ( - 'BlockId' => Array ('title' => 'column:la_fld_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter'), + 'BlockId' => Array ('title' => 'column:la_fld_Id', 'filter_block' => 'grid_range_filter', 'width' => 80), 'Title' => Array ('filter_block' => 'grid_like_filter'), - 'Status' => Array ('filter_block' => 'grid_options_filter'), - 'Priority' => Array ('title' => 'column:la_fld_Order', 'filter_block' => 'grid_range_filter'), - 'Sticky' => Array ('filter_block' => 'grid_options_filter'), - 'CSSClassName' => Array ('filter_block' => 'grid_options_filter'), + 'Status' => Array ('filter_block' => 'grid_options_filter', 'width' => 80), + 'Priority' => Array ('title' => 'column:la_fld_Order', 'filter_block' => 'grid_range_filter', 'width' => 80), + 'Sticky' => Array ('filter_block' => 'grid_options_filter', 'width' => 80), +// 'CSSClassName' => Array ('filter_block' => 'grid_options_filter'), 'LinkType' => Array ('filter_block' => 'grid_options_filter'), - 'CategoryId' => Array ('title' => 'column:la_fld_Category', 'filter_block' => 'grid_options_filter'), - 'ExternalLink' => Array ('filter_block' => 'grid_like_filter'), - 'ScheduleFromDate' => Array ('title' => 'la_col_ScheduleFromDate', 'filter_block' => 'grid_date_range_filter'), - 'ScheduleToDate' => Array ('title' => 'la_col_ScheduleToDate', 'filter_block' => 'grid_date_range_filter'), + 'CategoryId' => Array ('title' => 'column:la_fld_Category', 'filter_block' => 'grid_options_filter', 'width' => 200), + 'ExternalLink' => Array ('filter_block' => 'grid_like_filter', 'width' => 200), + 'ScheduleFromDate' => Array ('title' => 'la_col_ScheduleFromDate', 'filter_block' => 'grid_date_range_filter', 'width' => 120), + 'ScheduleToDate' => Array ('title' => 'la_col_ScheduleToDate', 'filter_block' => 'grid_date_range_filter', 'width' => 120), 'NumberOfClicks' => Array ('filter_block' => 'grid_range_filter'), 'NumberOfViews' => Array ('filter_block' => 'grid_range_filter'), - 'ConversionPercent' => Array ('filter_block' => 'grid_range_filter'), + 'ConversionPercent' => Array ('filter_block' => 'grid_range_filter', 'width' => 80), ), ), ),