Index: core/install/english.lang
===================================================================
--- core/install/english.lang (revision 14926)
+++ core/install/english.lang (working copy)
@@ -149,6 +149,7 @@
RGVmYXVsdCBDU1YgRXhwb3J0IEVuY29kaW5n
RGVmYXVsdCBDU1YgRXhwb3J0IE5ldyBMaW5lIFNlcGFyYXRvcg==
U2hvdyAiRm9ybXMgRWRpdG9yIiBpbiBERUJVRyBtb2RlIG9ubHk=
+ U2hvdyAiUHJvbW8gQmxvY2sgR3JvdXBzIEVkaXRvciIgaW4gREVCVUcgbW9kZSBvbmx5
RGVmYXVsdCBEZXNpZ24gVGVtcGxhdGU=
RGVmYXVsdCBSZWdpc3RyYXRpb24gQ291bnRyeQ==
RGVmYXVsdCBBbmFseXRpY3MgVHJhY2tpbmcgQ29kZQ==
@@ -175,10 +176,6 @@
UGF0aCB0byBXZWJzaXRl
UGVyZm9ybSBFeGFjdCBTZWFyY2g=
Q29tbWVudHMgcGVyIHBhZ2U=
- UHJvbW8gUm90YXRpb24gRGVsYXkgKHNlY29uZHMp
- UHJvbW8gVHJhbnNpdGlvbiBDb250cm9scw==
- UHJvbW8gVHJhbnNpdGlvbiBFZmZlY3Q=
- VHJhbnNpdGlvbiBEZWxheSAoc2Vjb25kcyk=
UXVpY2sgU2VjdGlvbiBQZXJtaXNzaW9uIFJlYnVpbGQ=
IlJlY3ljbGUgQmluIiBTZWN0aW9uSWQ=
VXNlcm5hbWUgUmVxdWlyZWQgRHVyaW5nIFJlZ2lzdHJhdGlvbg==
@@ -259,6 +256,7 @@
VGhpcyBvcGVyYXRpb24gaXMgbm90IGFsbG93ZWQh
VmFsaWRhdGlvbiBlcnJvciwgcGxlYXNlIGRvdWJsZS1jaGVjayBJbi1Qb3J0YWwgdGFncw==
UGFzc3dvcmRzIGRvIG5vdCBtYXRjaCE=
+ Q2FuJ3QgRGVsZXRlIE5vbi1FbXB0eSBQcm9tbyBCbG9jayBHcm91cA==
UmVxdWlyZWQgZmllbGQoLXMpIG5vdCBmaWxsZWQ=
cmVxdWlyZWQgY29sdW1ucyBtaXNzaW5n
Um9vdCBzZWN0aW9uIG9mIHRoZSBtb2R1bGUocykgY2FuIG5vdCBiZSBkZWxldGVkIQ==
@@ -308,6 +306,7 @@
QWxsb3cgQ2hhbmdpbmcgU2VuZGVy
QWx0IFZhbHVl
QW5zd2Vy
+ QXNzaWduZWQgdG8gU2VjdGlvbnM=
QXR0YWNobWVudA==
QXV0byBDcmVhdGUgRmlsZSBOYW1l
QXV0b21hdGljIEZpbGVuYW1l
@@ -544,6 +543,7 @@
UHJpbWFyeSBMYW5ndWFnZSBQaHJhc2U=
T3JkZXI=
Q29udmVydCB1bm1hdGNoZWQgZS1tYWlscyBpbnRvIG5ldyBzdWJtaXNzaW9ucw==
+ UHJvbW8gQmxvY2sgR3JvdXA=
UHJvdGVjdGVk
UXVhbnRpdHk=
UmF0aW5n
@@ -572,6 +572,7 @@
UmVxdWlyZWQ=
UmVxdWlyZSBMb2dpbg==
Q29tbWVudA==
+ UHJvbW8gUm90YXRpb24gRGVsYXkgKHNlY29uZHMp
UnVsZSBUeXBl
UnVuIEludGVydmFs
UnVuIE1vZGU=
@@ -625,6 +626,10 @@
VG8gRS1tYWls
VG9w
QW5hbHl0aWNzIFRyYWNraW5nIENvZGU=
+ UHJvbW8gVHJhbnNpdGlvbiBDb250cm9scw==
+ UHJvbW8gVHJhbnNpdGlvbiBFZmZlY3Q=
+ UHJvbW8gVHJhbnNpdGlvbiBFZmZlY3QgKGN1c3RvbSk=
+ VHJhbnNpdGlvbiBEZWxheSAoc2Vjb25kcyk=
UGhyYXNl
VHlwZQ==
TWVhc3VyZXMgU3lzdGVt
@@ -730,6 +735,7 @@
QWRkcmVzcw==
QWZ0ZXI=
QWxsb3c=
+ Q3VzdG9t
RmFkZQ==
U2xpZGU=
QXV0by1EZXRlY3Q=
@@ -1184,7 +1190,6 @@
UGhvbmU=
UG9wdWxhcg==
UG9wdWxhcml0eQ==
- UHJvbW8gU2V0dGluZ3M=
UmVhZHkgdG8gSW5zdGFsbA==
cmVjb3JkcyBhZGRlZA==
cmVjb3JkcyB1cGRhdGVk
@@ -1212,6 +1217,7 @@
QWRkaW5nIE1haWxpbmcgTGlzdA==
QWRkaW5nIFBlcm1pc3Npb24gVHlwZQ==
QWRkaW5nIFByb21vIEJsb2Nr
+ QWRkaW5nIFByb21vIEJsb2NrIEdyb3Vw
QWRkaW5nIFNjaGVkdWxlZCBUYXNr
QWRkaW5nIFNpdGUgRG9tYWlu
QWRkaW5nIFNraW4=
@@ -1264,6 +1270,7 @@
RWRpdGluZyBNZW1iZXJzaGlw
RWRpdGluZyBQZXJtaXNzaW9uIFR5cGU=
RWRpdGluZyBQcm9tbyBCbG9jaw==
+ RWRpdGluZyBQcm9tbyBCbG9jayBHcm91cA==
RWRpdGluZyBTY2hlZHVsZWQgVGFzaw==
RWRpdGluZyBTaXRlIERvbWFpbg==
RWRpdGluZyBTa2lu
@@ -1333,6 +1340,7 @@
UGVybWlzc2lvbnM=
TGFiZWxzICYgUGhyYXNlcw==
UGxlYXNlIFdhaXQ=
+ UHJvbW8gQmxvY2sgR3JvdXBz
UHJvbW8gQmxvY2tz
UHJvcGVydGllcw==
UmVsYXRlZCBTZWFyY2hlcw==
@@ -1473,6 +1481,7 @@
U2V0IFByaW1hcnkgU2VjdGlvbg==
U2V0IFByaW1hcnkgTGFuZ3VhZ2U=
U2V0IFN0aWNreQ==
+ U2V0dGluZ3M=
U2hvdyBNZW51
U3luY2hyb25pemUgTGFuZ3VhZ2Vz
VG9vbHM=
Index: core/install/install_data.sql
===================================================================
--- core/install/install_data.sql (revision 14924)
+++ core/install/install_data.sql (working copy)
@@ -67,11 +67,12 @@
INSERT INTO ConfigurationValues VALUES(DEFAULT, 'ResizableFrames', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_ResizableFrames', 'checkbox', '', '', 40.10, 0, 0, NULL);
INSERT INTO ConfigurationValues VALUES(DEFAULT, 'AutoRefreshIntervals', '1,5,15,30,60,120,240', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_AutoRefreshIntervals', 'text', '', '', 40.11, 0, 0, NULL);
INSERT INTO ConfigurationValues VALUES(DEFAULT, 'DebugOnlyFormConfigurator', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_DebugOnlyFormConfigurator', 'checkbox', '', '', 40.12, 0, 0, NULL);
-INSERT INTO ConfigurationValues VALUES(DEFAULT, 'RememberLastAdminTemplate', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_RememberLastAdminTemplate', 'checkbox', '', '', 40.13, 0, 0, NULL);
-INSERT INTO ConfigurationValues VALUES(DEFAULT, 'UseHTTPAuth', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_UseHTTPAuth', 'checkbox', '', '', 40.14, 0, 0, NULL);
-INSERT INTO ConfigurationValues VALUES(DEFAULT, 'HTTPAuthUsername', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_HTTPAuthUsername', 'text', '', '', 40.15, 0, 0, NULL);
-INSERT INTO ConfigurationValues VALUES(DEFAULT, 'HTTPAuthPassword', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_HTTPAuthPassword', 'password', NULL, NULL, 40.16, 0, 0, NULL);
-INSERT INTO ConfigurationValues VALUES(DEFAULT, 'HTTPAuthBypassIPs', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_HTTPAuthBypassIPs', 'text', '', '', 40.17, 0, 0, NULL);
+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);
+INSERT INTO ConfigurationValues VALUES(DEFAULT, 'RememberLastAdminTemplate', '1', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_RememberLastAdminTemplate', 'checkbox', '', '', 40.14, 0, 0, NULL);
+INSERT INTO ConfigurationValues VALUES(DEFAULT, 'UseHTTPAuth', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_UseHTTPAuth', 'checkbox', '', '', 40.15, 0, 0, NULL);
+INSERT INTO ConfigurationValues VALUES(DEFAULT, 'HTTPAuthUsername', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_HTTPAuthUsername', 'text', '', '', 40.16, 0, 0, NULL);
+INSERT INTO ConfigurationValues VALUES(DEFAULT, 'HTTPAuthPassword', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_HTTPAuthPassword', 'password', NULL, NULL, 40.17, 0, 0, NULL);
+INSERT INTO ConfigurationValues VALUES(DEFAULT, 'HTTPAuthBypassIPs', '', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsAdmin', 'la_config_HTTPAuthBypassIPs', 'text', '', '', 40.18, 0, 0, NULL);
INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Smtp_Server', NULL, 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMailling', 'la_prompt_mailserver', 'text', NULL, NULL, 50.01, 0, 1, NULL);
INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Smtp_Port', NULL, 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMailling', 'la_prompt_mailport', 'text', NULL, NULL, 50.02, 0, 1, NULL);
INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Smtp_Authenticate', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsMailling', 'la_prompt_mailauthenticate', 'checkbox', NULL, NULL, 50.03, 0, 1, NULL);
@@ -95,12 +96,6 @@
INSERT INTO ConfigurationValues VALUES(DEFAULT, 'CSVExportSeparator', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsCSVExport', 'la_config_CSVExportSeparator', 'radio', NULL, '0=la_Linux||1=la_Windows', 70.03, 0, 1, NULL);
INSERT INTO ConfigurationValues VALUES(DEFAULT, 'CSVExportEncoding', '0', 'In-Portal', 'in-portal:configure_advanced', 'la_section_SettingsCSVExport', 'la_config_CSVExportEncoding', 'radio', NULL, '0=la_Unicode||1=la_Regular', 70.04, 0, 1, NULL);
-# Section "in-portal:configure_promo_blocks":
-INSERT INTO ConfigurationValues VALUES (DEFAULT, 'PromoRotationDelay', '7', 'In-Portal', 'in-portal:configure_promo_blocks', 'la_Text_PromoSettings', 'la_config_PromoRotationDelay', 'text', '', '', 10.01, 0, 0, NULL);
-INSERT INTO ConfigurationValues VALUES (DEFAULT, 'PromoTransitionTime', '0.6', 'In-Portal', 'in-portal:configure_promo_blocks', 'la_Text_PromoSettings', 'la_config_PromoTransitionTime', 'text', '', '', 10.02, 0, 0, NULL);
-INSERT INTO ConfigurationValues VALUES (DEFAULT, 'PromoTransitionControls', '1', 'In-Portal', 'in-portal:configure_promo_blocks', 'la_Text_PromoSettings', 'la_config_PromoTransitionControls', 'select', '', '1=la_Enabled||0=la_Disabled', 10.03, 0, 0, NULL);
-INSERT INTO ConfigurationValues VALUES (DEFAULT, 'PromoTransitionEffect', 'fade', 'In-Portal', 'in-portal:configure_promo_blocks', 'la_Text_PromoSettings', 'la_config_PromoTransitionEffect', 'select', '', 'fade=la_opt_AnimationFade||slide=la_opt_AnimationSlide', 10.04, 0, 0, NULL);
-
# Section "in-portal:configure_users":
INSERT INTO ConfigurationValues VALUES(DEFAULT, 'User_Allow_New', '3', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_users_allow_new', 'radio', '', '1=la_opt_UserInstantRegistration||2=la_opt_UserNotAllowedRegistration||3=la_opt_UserUponApprovalRegistration||4=la_opt_UserEmailActivation', 10.01, 0, 1, NULL);
INSERT INTO ConfigurationValues VALUES(DEFAULT, 'AdvancedUserManagement', '0', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_prompt_AdvancedUserManagement', 'checkbox', NULL, NULL, 10.011, 0, 1, NULL);
@@ -673,6 +668,11 @@
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:submissions.view', 11, 1, 1, 0);
+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);
+
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:mailing_lists.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:mailing_lists.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:mailing_lists.edit', 11, 1, 1, 0);
@@ -994,5 +994,7 @@
#INSERT INTO PageContent VALUES (DEFAULT, 1, 1, 'In-portal is a revolutionary Web Site management system that allows you to automate and facilitate management of large portal and community web sites. Regardless of whether you are running a directory site or a content news portal, a community site or an online mall, In-portal will enhance your web site management experience with innovative.
We are proud to present our newly developed "default" theme that introduces a fresh look as well totally new approach in the template system. ', NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0);
+INSERT INTO PromoBlockGroups VALUES (DEFAULT, 'Default Group', UNIX_TIMESTAMP(), '1', '7.00', '0.60', '1', 'fade', '');
+
INSERT INTO Modules VALUES ('Core', 'core/', 'adm', DEFAULT, 1, 1, '', 0, NULL, NULL);
INSERT INTO Modules VALUES ('In-Portal', 'core/', 'm', DEFAULT, 1, 0, '', 0, NULL, NULL);
\ No newline at end of file
Index: core/install/install_schema.sql
===================================================================
--- core/install/install_schema.sql (revision 14917)
+++ core/install/install_schema.sql (working copy)
@@ -478,6 +478,7 @@
LiveRevisionNumber int(11) NOT NULL DEFAULT '1',
DirectLinkEnabled tinyint(4) NOT NULL DEFAULT '1',
DirectLinkAuthKey varchar(20) NOT NULL,
+ PromoBlockGroupId int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (CategoryId),
UNIQUE KEY ResourceId (ResourceId),
KEY ParentId (ParentId),
@@ -506,7 +507,8 @@
KEY OverridePageCacheKey (OverridePageCacheKey),
KEY PageExpiration (PageExpiration),
KEY Protected (Protected),
- KEY LiveRevisionNumber (LiveRevisionNumber)
+ KEY LiveRevisionNumber (LiveRevisionNumber),
+ KEY PromoBlockGroupId (PromoBlockGroupId)
);
CREATE TABLE CategoryCustomData (
@@ -1304,6 +1306,21 @@
l3_Html text,
l4_Html text,
l5_Html text,
+ PromoBlockGroupId int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (BlockId),
- KEY OpenInNewWindow (OpenInNewWindow)
+ KEY OpenInNewWindow (OpenInNewWindow),
+ KEY PromoBlockGroupId (PromoBlockGroupId)
+);
+
+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)
);
\ No newline at end of file
Index: core/install/remove_schema.sql
===================================================================
--- core/install/remove_schema.sql (revision 14917)
+++ core/install/remove_schema.sql (working copy)
@@ -74,3 +74,4 @@
DROP TABLE SiteDomains;
DROP TABLE CurlLog;
DROP TABLE PromoBlocks;
+DROP TABLE PromoBlockGroups;
Index: core/install/upgrades.sql
===================================================================
--- core/install/upgrades.sql (revision 14924)
+++ core/install/upgrades.sql (working copy)
@@ -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: core/units/categories/categories_config.php
===================================================================
--- core/units/categories/categories_config.php (revision 14917)
+++ core/units/categories/categories_config.php (working copy)
@@ -407,7 +407,12 @@
'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1,
'not_null' => 1, 'default' => 1
),
- 'DirectLinkAuthKey' => Array ('type' => 'string', 'max_len' => 20, 'not_null' => 1, 'default' => '')
+ 'DirectLinkAuthKey' => Array ('type' => 'string', 'max_len' => 20, 'not_null' => 1, 'default' => ''),
+ 'PromoBlockGroupId' => Array (
+ 'type' => 'int',
+ 'options_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'PromoBlockGroups ORDER BY Title', 'option_title_field' => 'Title', 'option_key_field' => 'PromoBlockGroupId',
+ 'not_null' => 1, 'default' => 0,
+ ),
),
'VirtualFields' => Array (
Index: core/units/promo_block_groups/promo_block_group_eh.php
===================================================================
--- core/units/promo_block_groups/promo_block_group_eh.php (revision 0)
+++ core/units/promo_block_groups/promo_block_group_eh.php (revision 0)
@@ -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: core/units/promo_block_groups/promo_block_group_tp.php
===================================================================
--- core/units/promo_block_groups/promo_block_group_tp.php (revision 0)
+++ core/units/promo_block_groups/promo_block_group_tp.php (revision 0)
@@ -0,0 +1,73 @@
+getObject($params);
+ /* @var $object kDBItem */
+
+ $ret = '';
+ $field = $this->SelectParam($params, 'name,field');
+ $categories = explode(';', $object->GetDBField($field));
+
+ $block_params = $this->prepareTagParams($params);
+ $block_params['name'] = $params['render_as'];
+
+ foreach ($categories as $category_id) {
+ if ( $category_id ) {
+ $block_params['cat_id'] = $category_id;
+ $ret .= $this->Application->ParseBlock($block_params);
+ }
+ }
+
+ return $ret;
+ }
+
+ /**
+ * Returns link to edit promo block group, associated with this promo block list
+ *
+ * @param Array $params
+ * @return string
+ * @return protected
+ */
+ protected function EditLink(Array $params)
+ {
+ $object =& $this->getObject($params);
+ /* @var $object kDBItem */
+
+ $prefix = $object->getPrefixSpecial();
+
+ $url_params = Array (
+ 'm_opener' => 'd',
+ $prefix . '_mode' => 't',
+ $prefix . '_event' => 'OnEdit',
+ $prefix . '_id' => $object->GetID(),
+ 'pass' => 'all,' . $prefix,
+ 'no_pass_through' => 1,
+ );
+
+ return $this->Application->HREF($params['edit_template'], '', $url_params);
+ }
+}
Index: core/units/promo_block_groups/promo_block_groups_config.php
===================================================================
--- core/units/promo_block_groups/promo_block_groups_config.php (revision 0)
+++ core/units/promo_block_groups/promo_block_groups_config.php (revision 0)
@@ -0,0 +1,120 @@
+ 'promo-block-group',
+ 'ItemClass' => Array ('class' => 'kDBItem', 'file' => '', 'build_event' => 'OnItemBuild'),
+ 'ListClass' => Array ('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'),
+ 'EventHandlerClass' => Array ('class' => 'PromoBlockGroupEventHandler', 'file' => 'promo_block_group_eh.php', 'build_event' => 'OnBuild'),
+ 'TagProcessorClass' => Array ('class' => 'PromoBlockGroupTagProcessor', 'file' => 'promo_block_group_tp.php', 'build_event' => 'OnBuild'),
+
+ 'AutoLoad' => true,
+
+ 'QueryString' => Array (
+ 1 => 'id',
+ 2 => 'Page',
+ 3 => 'PerPage',
+ 4 => 'event',
+ 5 => 'mode',
+ ),
+
+ 'IDField' => 'PromoBlockGroupId',
+
+ 'TableName' => TABLE_PREFIX . 'PromoBlockGroups',
+
+ 'TitleField' => 'Title',
+
+ 'StatusField' => Array('Status'),
+
+ 'TitlePresets' => Array (
+ 'default' => Array (
+ 'new_status_labels' => Array ('promo-block-group' => '!la_title_AddingPromoBlockGroup!'),
+ 'edit_status_labels' => Array ('promo-block-group' => '!la_title_EditingPromoBlockGroup!'),
+ ),
+
+ 'promo_block_group_list' => Array ('prefixes' => Array ('promo-block-group_List'), 'format' => "!la_title_PromoBlockGroups! (#promo-block-group_recordcount#)"),
+ 'promo_block_group_edit' => Array ('prefixes' => Array ('promo-block-group'), 'format' => "#promo-block-group_status# '#promo-block-group_titlefield#'"),
+ ),
+
+ 'PermSection' => Array('main' => 'in-portal:promo_block_groups'),
+
+ 'Sections' => Array (
+ 'in-portal:promo_block_groups' => Array(
+ 'parent' => 'in-portal:site',
+ 'icon' => 'promo_block_groups',
+ 'label' => 'la_tab_PromoBlocks',
+ 'url' => Array('t' => 'promo_block_groups/promo_block_group_list', 'pass' => 'm'),
+ 'late_load' => Array ('t' => 'promo_block_groups/tree_section_xml', 'pass' => 'm'),
+ 'permissions' => Array('view', 'add', 'edit', 'delete'),
+ 'priority' => 7,
+ 'type' => stTREE,
+ ),
+ ),
+
+ 'CalculatedFields' => Array (
+ '' => Array (
+ 'AssignedToSections' => '(SELECT GROUP_CONCAT(CategoryId SEPARATOR ";") FROM '.TABLE_PREFIX.'Category WHERE PromoBlockGroupId = %1$s.PromoBlockGroupId)',
+ ),
+ ),
+
+
+ 'ListSQLs' => Array (
+ '' => ' SELECT %1$s.* %2$s FROM %1$s',
+ ),
+
+ 'ListSortings' => Array (
+ '' => Array (
+ 'Sorting' => Array ('Title' => 'asc'),
+ )
+ ),
+
+ 'Fields' => Array (
+ 'PromoBlockGroupId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
+ 'Title' => Array (
+ 'type' => 'string', 'max_len' => 255,
+ 'not_null' => 1, 'required' => 1, 'default' => '',
+ ),
+ 'CreatedOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#'),
+ 'Status' => Array (
+ 'type' => 'int',
+ 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Enabled', 0 => 'la_Disabled'), 'use_phrases' => 1,
+ 'not_null' => 1, 'required' => 1, 'default' => 1,
+ ),
+ 'RotationDelay' => Array ('type' => 'float', 'formatter' => 'kFormatter', 'format' => '%01.2f', 'required' => 1, 'default' => NULL),
+ 'TransitionTime' => Array ('type' => 'float', 'formatter' => 'kFormatter', 'format' => '%01.2f', 'required' => 1, 'default' => NULL),
+ 'TransitionControls' => Array (
+ 'type' => 'int',
+ 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Enabled', 0 => 'la_Disabled'), 'use_phrases' => 1,
+ 'not_null' => 1, 'default' => 1,
+ ),
+ 'TransitionEffect' => Array (
+ 'type' => 'string',
+ 'formatter' => 'kOptionsFormatter', 'options' => Array ('fade' => 'la_opt_AnimationFade', 'slide' => 'la_opt_AnimationSlide', '-1' => 'la_opt_AnimationCustom'), 'use_phrases' => 1,
+ 'not_null' => 1, 'required' => 1, 'default' => '',
+ ),
+ 'TransitionEffectCustom' => Array (
+ 'type' => 'string',
+ 'error_field' => 'TransitionEffect',
+ 'formatter' => 'kFormatter',
+ 'not_null' => 1, 'default' => '',
+ ),
+ ),
+
+ 'VirtualFields' => Array(
+ 'AssignedToSections' => Array('type' => 'string', 'default' => ''),
+ ),
+
+ 'Grids' => Array (
+ 'Default' => Array (
+ 'Icons' => Array ('default' => 'icon16_item.png', 0 => 'icon16_disabled.png', 1 => 'icon16_item.png'),
+ 'Fields' => Array (
+ 'PromoBlockGroupId' => Array ('title' => 'column:la_fld_Id', 'filter_block' => 'grid_range_filter', 'width' => 80),
+ 'Title' => Array ('filter_block' => 'grid_like_filter', 'width' => 150),
+ 'RotationDelay' => Array ('filter_block' => 'grid_range_filter'),
+ 'TransitionTime' => Array ('filter_block' => 'grid_range_filter'),
+ 'TransitionControls' => Array ('filter_block' => 'grid_options_filter'),
+ 'TransitionEffect' => Array ('filter_block' => 'grid_options_filter'),
+ 'TransitionEffectCustom' => Array ('filter_block' => 'grid_like_filter'),
+ ),
+ ),
+ ),
+);
Index: core/units/promo_blocks/promo_block_eh.php
===================================================================
--- core/units/promo_blocks/promo_block_eh.php (revision 14917)
+++ core/units/promo_blocks/promo_block_eh.php (working copy)
@@ -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: core/units/promo_blocks/promo_block_tp.php
===================================================================
--- core/units/promo_blocks/promo_block_tp.php (revision 14917)
+++ core/units/promo_blocks/promo_block_tp.php (working copy)
@@ -55,4 +55,37 @@
return $object->GetDBField('OpenInNewWindow');
}
+
+ /**
+ * Get value from corresponding PromoGroupBlocks record
+ *
+ * @param Array $params
+ * @return bool
+ * @access protected
+ */
+ protected function GetGroupSetting(Array $params)
+ {
+ static $group_data = null;
+
+ if ( !isset($group_data) ) {
+ if ( isset($params['group_id']) && $params['group_id'] ) {
+ $group_id = $params['group_id'];
+ }
+ else {
+ $page =& $this->Application->recallObject('st');
+ /* @var $page CategoriesItem */
+
+ $group_id = $page->GetDBField('PromoBlockGroupId');
+ }
+
+ $sql = 'SELECT *
+ FROM ' . TABLE_PREFIX . 'PromoBlockGroups
+ WHERE PromoBlockGroupId = ' . (int)$group_id;
+ $group_data = $this->Conn->GetRow($sql);
+ }
+
+ $setting_name = $params['name'];
+
+ return isset($group_data[$setting_name]) ? $group_data[$setting_name] : '';
+ }
}
Index: core/units/promo_blocks/promo_blocks_config.php
===================================================================
--- core/units/promo_blocks/promo_blocks_config.php (revision 14917)
+++ core/units/promo_blocks/promo_blocks_config.php (working copy)
@@ -29,34 +29,12 @@
'edit_status_labels' => Array ('promo-block' => '!la_title_EditingPromoBlock!'),
),
- 'promo_block_list' => Array ('prefixes' => Array ('promo-block_List'), 'format' => "!la_tab_PromoBlocks! (#promo-block_recordcount#)"),
+ 'promo_block_list' => Array ('prefixes' => Array ('promo-block-group', 'promo-block_List'), 'format' => "!la_tab_PromoBlocks! - #promo-block-group_titlefield# (#promo-block_recordcount#)"),
'promo_block_edit' => Array ('prefixes' => Array ('promo-block'), 'format' => "#promo-block_status# '#promo-block_titlefield#'"),
),
- 'PermSection' => Array('main' => 'in-portal:promo_blocks'),
+ 'PermSection' => Array('main' => 'in-portal:promo_block_groups'),
- 'Sections' => Array (
- 'in-portal:promo_blocks' => Array(
- 'parent' => 'in-portal:site',
- 'icon' => 'custom',
- 'label' => 'la_tab_PromoBlocks',
- 'url' => Array('t' => 'promo_blocks/promo_block_list', 'pass' => 'm'),
- 'permissions' => Array('view', 'add', 'edit', 'delete'),
- 'priority' => 7,
- 'type' => stTREE,
- ),
-
- 'in-portal:configure_promo_blocks' => Array (
- 'parent' => 'in-portal:website_setting_folder',
- 'icon' => 'custom',
- 'label' => 'la_title_PromoBlocks',
- 'url' => Array ('t' => 'config/config_universal', 'pass_section' => true, 'pass' => 'm'),
- 'permissions' => Array ('view', 'edit'),
- 'priority' => 3,
- 'type' => stTREE,
- ),
- ),
-
'CalculatedFields' => Array (
'' => Array (
'ConversionPercent' => 'IF(%1$s.NumberOfViews > 0, NumberOfClicks / NumberOfViews * 100, NULL)',
@@ -75,6 +53,11 @@
'Fields' => Array (
'BlockId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
+ 'PromoBlockGroupId' => Array (
+ 'type' => 'int',
+ 'options_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'PromoBlockGroups ORDER BY Title', 'option_title_field' => 'Title', 'option_key_field' => 'PromoBlockGroupId',
+ 'not_null' => 1, 'required' => 1, 'default' => 0,
+ ),
'Title' => Array (
'type' => 'string', 'max_len' => 50,
'not_null' => 1, 'required' => 1, 'default' => '',
|