Index: branches/5.2.x/core/admin_templates/promo_block_groups/tree_section_xml.tpl =================================================================== diff -u -N --- branches/5.2.x/core/admin_templates/promo_block_groups/tree_section_xml.tpl (revision 0) +++ branches/5.2.x/core/admin_templates/promo_block_groups/tree_section_xml.tpl (revision 14929) @@ -0,0 +1,7 @@ + + + + + + + Index: branches/5.2.x/core/admin_templates/promo_block_groups/promo_block_group_list.tpl =================================================================== diff -u -N --- branches/5.2.x/core/admin_templates/promo_block_groups/promo_block_group_list.tpl (revision 0) +++ branches/5.2.x/core/admin_templates/promo_block_groups/promo_block_group_list.tpl (revision 14929) @@ -0,0 +1,69 @@ + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + Index: branches/5.2.x/core/admin_templates/promo_blocks/promo_block_list.tpl =================================================================== diff -u -N -r14853 -r14929 --- branches/5.2.x/core/admin_templates/promo_blocks/promo_block_list.tpl (.../promo_block_list.tpl) (revision 14853) +++ branches/5.2.x/core/admin_templates/promo_blocks/promo_block_list.tpl (.../promo_block_list.tpl) (revision 14929) @@ -1,12 +1,14 @@ - + + + +
+
+ + + + + + + + + + + + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + display: none;" type="text" name="" id="" value="" tabindex=""/> +
+
+ + + Index: branches/5.2.x/admin/system_presets/simple/promo_block_groups_promo-block-group.php =================================================================== diff -u -N --- branches/5.2.x/admin/system_presets/simple/promo_block_groups_promo-block-group.php (revision 0) +++ branches/5.2.x/admin/system_presets/simple/promo_block_groups_promo-block-group.php (revision 14929) @@ -0,0 +1,53 @@ + Array ('new_item', 'edit', 'delete', 'view', 'dbl-click'), + +// editing promo block group +// 'promo_block_groups_edit' => Array ('select', 'cancel', 'prev', 'next'), + ); + + // fields to hide + $hidden_fields = Array ( + /* 'PromoBlockGroupId', 'Title', 'CreatedOn', 'Status', 'RotationDelay', 'TransitionTime', 'TransitionControls', 'TransitionEffect', 'TransitionEffectCustom', */ + ); + + // virtual fields to hide + $virtual_hidden_fields = Array ( + + ); + + // fields to make required + $required_fields = Array ( + /* 'PromoBlockGroupId', */ 'Title', /* 'CreatedOn', 'Status', 'RotationDelay', 'TransitionTime', 'TransitionControls', 'TransitionEffect', 'TransitionEffectCustom', */ + ); + + // virtual fields to make required + $virtual_required_fields = Array ( + + ); + + // tabs during editing + $hide_edit_tabs = Array ( +// tabs during form editing + ); + + // hide columns in grids + $hide_columns = Array ( +// list of promo block groups +// 'Default' => Array ('PromoBlockGroupId', 'Title'), + ); Index: branches/5.2.x/core/admin_templates/tree.tpl =================================================================== diff -u -N -r14734 -r14929 --- branches/5.2.x/core/admin_templates/tree.tpl (.../tree.tpl) (revision 14734) +++ branches/5.2.x/core/admin_templates/tree.tpl (.../tree.tpl) (revision 14929) @@ -173,15 +173,21 @@ } } - - - - var $forms_node = the_tree.locateItemByURL(''); - $forms_node.Container = true; - - - - + + var $container_node = the_tree.locateItemByURL(''); + $container_node.Container = true; + + + + + + + + + + + + Index: branches/5.2.x/core/install/remove_schema.sql =================================================================== diff -u -N -r14892 -r14929 --- branches/5.2.x/core/install/remove_schema.sql (.../remove_schema.sql) (revision 14892) +++ branches/5.2.x/core/install/remove_schema.sql (.../remove_schema.sql) (revision 14929) @@ -74,3 +74,4 @@ DROP TABLE SiteDomains; DROP TABLE CurlLog; DROP TABLE PromoBlocks; +DROP TABLE PromoBlockGroups; Index: branches/5.2.x/core/units/promo_block_groups/promo_block_group_eh.php =================================================================== diff -u -N --- branches/5.2.x/core/units/promo_block_groups/promo_block_group_eh.php (revision 0) +++ branches/5.2.x/core/units/promo_block_groups/promo_block_group_eh.php (revision 14929) @@ -0,0 +1,131 @@ +beforeItemChange($event); + } + + /** + * Occurs before updating item + * + * @param kEvent $event + * @return void + * @access protected + */ + protected function OnBeforeItemUpdate(&$event) + { + parent::OnBeforeItemUpdate($event); + $this->beforeItemChange($event); + } + + /** + * Occurs before updating item + * + * @param kEvent $event + * @return void + * @access private + */ + private function beforeItemChange(&$event) + { + $object =& $event->getObject(); + /* @var $object kDBItem */ + + $object->setRequired('TransitionEffectCustom', $object->GetDBField('TransitionEffect') == '-1'); + } + + /** + * Occurs before deleting item + * + * @param kEvent $event + * @return void + */ + function OnBeforeItemDelete(&$event) + { + parent::OnBeforeItemDelete($event); + + $object =& $event->getObject(); + /* @var $object kDBItem */ + + $sql = 'SELECT BlockId + FROM ' . TABLE_PREFIX . 'PromoBlocks + WHERE PromoBlockGroupId = ' . $object->GetID(); + $block_id = $this->Conn->GetOne($sql); + + if ( $block_id ) { + $event->MasterEvent->SetRedirectParam('grid_error', 'la_error_PromoGroupNotEmpty'); + $event->status = kEvent::erFAIL; + } + } + + /** + * Deleting empty promo block group disconnects it from associated sections + * + * @param kEvent $event + * @return void + */ + function OnAfterItemDelete(&$event) + { + parent::OnAfterItemDelete($event); + + $sql = 'UPDATE ' . TABLE_PREFIX . 'Category + SET PromoBlockGroupId = 0 + WHERE PromoBlockGroupId = ' . $event->getEventParam('id'); + $this->Conn->Query($sql); + } + + /** + * Set tree update flag + * + * @param kEvent $event + * @return void + * @access protected + */ + protected function OnSave(&$event) + { + parent::OnSave($event); + + if ( $event->status == kEvent::erSUCCESS ) { + $event->SetRedirectParam('refresh_tree', 1); + } + } + + /** + * Set tree update flag + * + * @param kEvent $event + * @return void + * @access protected + */ + protected function OnMassDelete(&$event) + { + parent::OnMassDelete($event); + + if ( $event->status == kEvent::erSUCCESS ) { + $event->SetRedirectParam('refresh_tree', 1); + } + } +} Index: branches/5.2.x/core/admin_templates/promo_block_groups/section_reload.tpl =================================================================== diff -u -N --- branches/5.2.x/core/admin_templates/promo_block_groups/section_reload.tpl (revision 0) +++ branches/5.2.x/core/admin_templates/promo_block_groups/section_reload.tpl (revision 14929) @@ -0,0 +1,12 @@ + + var $menu_frame = getFrame('menu'); + + + $menu_frame.ReloadFolder('', true); + + + + $menu_frame.SyncActive(''); + + + Index: branches/5.2.x/core/units/promo_blocks/promo_block_eh.php =================================================================== diff -u -N -r14853 -r14929 --- branches/5.2.x/core/units/promo_blocks/promo_block_eh.php (.../promo_block_eh.php) (revision 14853) +++ branches/5.2.x/core/units/promo_blocks/promo_block_eh.php (.../promo_block_eh.php) (revision 14929) @@ -52,6 +52,26 @@ } /** + * Sets default value for promo block group + * + * @param kEvent $event + * @return void + * @access protected + */ + protected function OnPreCreate(&$event) + { + parent::OnPreCreate($event); + + $object =& $event->getObject(); + /* @var $object kDBItem */ + + $promo_block_group =& $this->Application->recallObject('promo-block-group'); + /* @var $promo_block_group kDBItem */ + + $object->SetDBField('PromoBlockGroupId', $promo_block_group->GetID()); + } + + /** * Processes OnMassMoveUp, OnMassMoveDown events * * @param kEvent $event @@ -74,18 +94,30 @@ { parent::SetCustomQuery($event); - if ( $this->Application->isAdminUser ) { + $object =& $event->getObject(); + /* @var $object kDBList */ + + if ( $this->Application->isAdmin ) { + $promo_block_group =& $this->Application->recallObject('promo-block-group'); + /* @var $promo_block_group kDBItem */ + + $object->addFilter('promo_group_filter', '%1$s.PromoBlockGroupId = ' . $promo_block_group->GetID()); return; } - $object =& $event->getObject(); - /* @var $object kDBList */ + $group_id = $event->getEventParam('group_id'); - if ( $event->Special == 'home' ) { - $object->addFilter('status_filter', '%1$s.Status = ' . STATUS_ACTIVE); - $object->addFilter('scheduled_from_filter', '%1$s.ScheduleFromDate IS NULL OR %1$s.ScheduleFromDate <= ' . TIMENOW); - $object->addFilter('scheduled_to_filter', '%1$s.ScheduleToDate IS NULL OR %1$s.ScheduleToDate >= ' . TIMENOW); + if ( !$group_id ) { + $page =& $this->Application->recallObject('st'); + /* @var $page CategoriesItem */ + + $group_id = $page->GetDBField('PromoBlockGroupId'); } + + $object->addFilter('status_filter', '%1$s.Status = ' . STATUS_ACTIVE); + $object->addFilter('scheduled_from_filter', '%1$s.ScheduleFromDate IS NULL OR %1$s.ScheduleFromDate <= ' . TIMENOW); + $object->addFilter('scheduled_to_filter', '%1$s.ScheduleToDate IS NULL OR %1$s.ScheduleToDate >= ' . TIMENOW); + $object->addFilter('promo_group_filter', $group_id ? '%1$s.PromoBlockGroupId = ' . $group_id : 'FALSE'); } /** @@ -293,7 +325,7 @@ 'type' => 'string', 'max_len' => 255, 'formatter' => 'kUploadFormatter', 'upload_dir' => IMAGES_PATH, 'multiple' => 1, 'thumb_format' => 'resize:100x100', - 'file_types' => '*.jpg;*.gif;*.png', 'files_description' => '!la_Image_Files!', + 'file_types' => '*.jpg;*.gif;*.png', 'files_description' => '!la_hint_ImageFiles!', 'required' => 1, 'not_null' => 1, 'default' => '', ); Index: branches/5.2.x/core/install/upgrades.sql =================================================================== diff -u -N -r14924 -r14929 --- branches/5.2.x/core/install/upgrades.sql (.../upgrades.sql) (revision 14924) +++ branches/5.2.x/core/install/upgrades.sql (.../upgrades.sql) (revision 14929) @@ -2428,4 +2428,48 @@ UPDATE ConfigurationValues SET HintLabel = CONCAT('hint:', Prompt) -WHERE VariableName IN ('ForceModRewriteUrlEnding', 'PerformExactSearch'); \ No newline at end of file +WHERE VariableName IN ('ForceModRewriteUrlEnding', 'PerformExactSearch'); + +DELETE FROM Phrase +WHERE PhraseKey IN ( + 'LA_TEXT_PROMOSETTINGS', 'LA_CONFIG_PROMOROTATIONDELAY', 'LA_CONFIG_PROMOTRANSITIONTIME', + 'LA_CONFIG_PROMOTRANSITIONCONTROLS', 'LA_CONFIG_PROMOTRANSITIONEFFECT' +); + +DELETE FROM ConfigurationValues WHERE VariableName IN ('PromoRotationDelay', 'PromoTransitionTime', 'PromoTransitionControls', 'PromoTransitionEffect'); +DELETE FROM Permissions WHERE Permission LIKE 'in-portal:promo_blocks.%'; + +CREATE TABLE PromoBlockGroups ( + PromoBlockGroupId int(11) NOT NULL AUTO_INCREMENT, + Title varchar(255) NOT NULL DEFAULT '', + CreatedOn int(10) unsigned DEFAULT NULL, + `Status` tinyint(1) NOT NULL DEFAULT '1', + RotationDelay decimal(9,2) DEFAULT NULL, + TransitionTime decimal(9,2) DEFAULT NULL, + TransitionControls tinyint(1) NOT NULL DEFAULT '1', + TransitionEffect varchar(255) NOT NULL DEFAULT '', + TransitionEffectCustom varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (PromoBlockGroupId) +); + +ALTER TABLE Category + ADD PromoBlockGroupId int(10) unsigned NOT NULL DEFAULT '0', + ADD INDEX (PromoBlockGroupId); + +ALTER TABLE PromoBlocks + ADD PromoBlockGroupId int(10) unsigned NOT NULL DEFAULT '0', + ADD INDEX (PromoBlockGroupId); + +INSERT INTO ConfigurationValues VALUES(DEFAULT, 'DebugOnlyPromoBlockGroupConfigurator', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_DebugOnlyPromoBlockGroupConfigurator', 'checkbox', '', '', 40.13, 0, 0, NULL); + +UPDATE ConfigurationValues +SET DisplayOrder = DisplayOrder + 0.01 +WHERE VariableName IN ('RememberLastAdminTemplate', 'UseHTTPAuth', 'HTTPAuthUsername', 'HTTPAuthPassword', 'HTTPAuthBypassIPs'); + +INSERT INTO PromoBlockGroups VALUES (DEFAULT, 'Default Group', UNIX_TIMESTAMP(), '1', '7.00', '0.60', '1', 'fade', ''); +UPDATE PromoBlocks SET PromoBlockGroupId = 1; + +INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:promo_block_groups.view', 11, 1, 1, 0); +INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:promo_block_groups.add', 11, 1, 1, 0); +INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:promo_block_groups.edit', 11, 1, 1, 0); +INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:promo_block_groups.delete', 11, 1, 1, 0); Index: branches/5.2.x/admin/system_presets/simple/categories_c.php =================================================================== diff -u -N -r14572 -r14929 --- branches/5.2.x/admin/system_presets/simple/categories_c.php (.../categories_c.php) (revision 14572) +++ branches/5.2.x/admin/system_presets/simple/categories_c.php (.../categories_c.php) (revision 14929) @@ -42,7 +42,7 @@ 'CachedNavbar',*/ 'CreatedById', /*'ResourceId', 'ParentPath', 'TreeLeft', 'TreeRight', 'NamedParentPath', 'MetaDescription', 'HotItem',*/ 'NewItem', /*'PopItem', 'Modified', 'ModifiedById', 'CachedTemplate',*/ 'Template', /*'UseExternalUrl', 'ExternalUrl',*/ 'UseMenuIconUrl', 'MenuIconUrl', 'Title', 'MenuTitle', - /*'MetaTitle', 'IndexTools', 'IsMenu',*/'Protected', 'Type', 'FormId', 'FormSubmittedTemplate', + /*'MetaTitle', 'IndexTools', 'IsMenu',*/'PromoBlockGroupId', 'Protected', 'Type', 'FormId', 'FormSubmittedTemplate', /*'FriendlyURL', 'ThemeId', 'EnablePageCache', 'OverridePageCacheKey', 'PageCacheKey', 'PageExpiration'*/ );